php-crud-api
php-crud-api copied to clipboard
Compressed (gzip) PUT and POST request body
Hi, First of all, this API is amazing! One single file and so much power :) I would like to send compressed gzip content through POST and PUT requests (I send posts with tens or hundreds of objects, hence compression would be a great feature). I see the API does not support this by default. How do you recommend doing this? I guess the best thing would be checking the headers and if 'Content-Encoding' contains 'gzip' --> uncompress before managing the data. I would like to:
- Either introduce this into my config file
- Have it in the php-crud-api repo. Otherwise, I would have a library/file that could not be updated anymore as easily. I thought I could use the 'before' function but I see I wouldn't have access to the headers from there. Please advice me about this. Thanks!
I would like to send compressed gzip content through POST and PUT requests
Sounds like a good feature request.
I guess the best thing would be checking the headers
Probably not needed. This should be easily detectable from the input data itself based on the first two bytes (a magic number):
a 10-byte header, containing a magic number (1f 8b), compression id, file flags, a timestamp, compression flags and operating system id.
See: https://en.wikipedia.org/wiki/Gzip
@mevdschee That would be great !
Okay.. but how do I test? Is there a client that sends gzip content? What is your use case?