Skip to content

Commit

Permalink
chore: Compress (gzip) request if server support it
Browse files Browse the repository at this point in the history
  • Loading branch information
PatrykGala committed Oct 4, 2023
1 parent a57aa7e commit 319172a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/neptune/internal/backends/hosted_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@

class GzipAdapter(HTTPAdapter):
def send(self, request, stream=False, **kw):
if request.body is not None and not stream:
if request.body is not None and not stream and request.headers.get("Content-Type", None) == "application/json":
request_body = request.body if isinstance(request.body, bytes) else bytes(request.body, "utf-8")
gzip_compress = zlib.compressobj(zlib.Z_DEFAULT_COMPRESSION, zlib.DEFLATED, zlib.MAX_WBITS | 16)
compressed = gzip_compress.compress(request_body) + gzip_compress.flush()
Expand Down

0 comments on commit 319172a

Please sign in to comment.