RequestAsync Content-Length header and compression options

As a Roblox developer, it is currently impossible to set the Content-Length header or use compression when using the function RequestAsync.

Error example:-

Note that the Authorization header it set by me.

Headers received from client using RequestAsync and Accept-Encoding gzip, deflate is sent:-

The Content-Length header is included when using PostAsync and compression is possible.

With the addition of a compression option and the use of the Content-Length header to RequestAsync I would be able to handle Http calls more efficiently by using the dictionary response which is not included in PostAsync.

This would also potentially lead to the deprecation of RequestAsync/GetAsync as RequestAsync would then be capable of the same functionality.

Other
Roblox-Id header is not documented and can this be removed as it is not required.

1 Like

So you want to be able to compress request bodies? We would probably implement this as a Compression = “gzip” option and then handle it for you automatically so you wouldn’t have to do it in Lua because that is slow.

4 Likes

My current use case is for game analytics which supports a request body of up to 1mb. Being able to compress this amount data would help a lot.

It would not be practical for me to develop a gzip module as it would also require me to develop a deflate compression module which in turn uses LZ77 and Huffman coding. As you said it would be slow to implement this in Lua and the lack of bit operations do not help.

Implementing this as a option for RequestAsync would definitely help.

1 Like

I am sending huge data to my servers and RequestAsync not having compression is really upsetting to me. PostAsync is extremely ugly and should be deprecated, but RequestAsync doesn’t seem to support compression?

2 Likes