Add Gzip to response types (#795)
* Add gzip to API.py * pytest for gzip * fix pytest * Update test_api.py * Add gzip to server block of configuration files * Update api.py to include gzip opts from config Update logic behind gzip compression such that compression will only happen when gzip in the Accept-Encoding request header and config.server.gzip is True. Use server charset for encoding/decoding and include charset in Content-Type when compressed. * Update pytest to use gzip config options Update pytest to test with (gzip in Accept-Encoding & server.gzip = False), (gzip in Accept-Encoding & server.gzip = True), (gzip not in Accept-Encoding & server.gzip = True) * Better Content Negotiation (#7) * Change content negotiation in _get_format() * Add to pytest and force h to always be string * Force F_JSON to default response * Update test_api.py for utf-16 encoding * better content negotiation pytest. * Add comments to pytest * Fix flake 8 * Improve docstring for gzip decorator function
This commit is contained in:
@@ -41,6 +41,7 @@ The ``server`` section provides directives on binding and high level tuning.
|
||||
mimetype: application/json; charset=UTF-8 # default MIME type
|
||||
encoding: utf-8 # default server encoding
|
||||
language: en-US # default server language
|
||||
gzip: false # default server config to gzip/compress responses to requests with gzip in the Accept-Encoding header
|
||||
cors: true # boolean on whether server should support CORS
|
||||
pretty_print: true # whether JSON responses should be pretty-printed
|
||||
limit: 10 # server limit on number of items to return
|
||||
|
||||
Reference in New Issue
Block a user