CodingAleCR / http_interceptor

A lightweight, simple plugin that allows you to intercept request and response objects and modify them if desired.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

zhukeev opened this issue · comments

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):

  • Flutter version: 2.10.4
  • IDE: VS Code
  • http_interceptor: ^2.0.0-beta.5

Additional context
Add any other context about the problem here.

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

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.

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.