CodingAleCR / http_interceptor

A lightweight, simple plugin that allows you to intercept request and response objects and modify them if desired.
MIT License
133 stars 67 forks source link

Unhandled Exception: FormatException: Unexpected extension byte (at offset 1) #113

Closed zhukeev closed 2 years ago

zhukeev commented 2 years ago

Describe the bug A clear and concise description of what the bug is. Can't send encoded body with GZipCodec().encode(utf8.encode( json.encode(body), )) but http can To Reproduce Steps to reproduce the behavior:

  1. Encode body with GZipCodec().encode(utf8.encode( json.encode(body),))
  2. Make post request
  3. See error

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

Please complete the following information):

Additional context Add any other context about the problem here.

CodingAleCR commented 2 years ago

Hey, thanks for creating an issue for this. I will take a look as soon as I can.

CodingAleCR commented 2 years ago

Hey, are you able to provide a bit more context of what are you seeing from your side, like how is the error presented in your case.

CodingAleCR commented 2 years ago

Hey @zhukeev this seems to be an exception coming straight from the SDK, not a problem from the library. In any case, digging a bit online I found this SO thread that might help you solve your issues.

As a bonus, I've added a test for checking GZip compression in #114 . This test takes the approach recommended in the thread I just linked and worked like a charm for fixing the exception you were having (from what I could reproduce).

As this is not exactly the library's fault, I'll close the issue and pin it for others in the future.