Skip to content

Deflate fails on server response without zlib header #3887

@Semptic

Description

@Semptic

Describe the bug

Some servers are not sending a zlib header in their deflated data. CURL had the same problem and implemented a "fix" for it: https://github.com/curl/curl/blob/5c932f8fe9dad94a7417702958ffa9e8db67c549/lib/content_encoding.c#L227-L229

Axios is also returning a Z_DATA_ERROR in this case.

To Reproduce

Use axios to request a page without a zlib header in the deflated data (e.g. https://www.konicaminolta.eu/eu-en/about-us/corporate-book) and force it to only accept deflate encoding.

let url = 'https://www.konicaminolta.eu/eu-en/about-us/corporate-book';
let config = {
  headers: { 'Accept-Encoding': 'deflate' }
};

await axios.get(url, config);

Expected behavior

Getting the correctly inflated data.

Environment

  • Axios Version [0.21.1]

Additional context/Screenshots

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions