Quantcast
Viewing all articles
Browse latest Browse all 45

Accept gzipped body in FastAPI / Uvicorn

I'm using FastAPI with Uvicorn to implement a u-service which accepts a json payload in the request's body. Since the request body can be quite large, I wish the service to accept gzipped. How do I accomplish that?

So far the following:

  • added the GZipMiddleware, but it encodes responses, rather that decoding requests
  • added a 'Content-Encoding: gzip' to my request

Fail with response:

Status: 400 Bad Request
{ "detail": "There was an error parsing the body" }


Viewing all articles
Browse latest Browse all 45

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>