Skip to content

Fixing Z_BUF_ERROR when no content#4701

Merged
jasonsaayman merged 5 commits intoaxios:masterfrom
lejahmie:bugfix/z_buf_error-no-content
May 12, 2022
Merged

Fixing Z_BUF_ERROR when no content#4701
jasonsaayman merged 5 commits intoaxios:masterfrom
lejahmie:bugfix/z_buf_error-no-content

Conversation

@lejahmie
Copy link
Copy Markdown
Contributor

@lejahmie lejahmie commented May 10, 2022

When response headers content-encoding is set but no content exist zlib fails with Z_BUF_ERROR.

Solution is to check if data exist, if it does not we should never try to decompress.
If no data exists, but content-encoding still says it is encoded we simply remove the header not confuse downstream operations.

Fixes:
#3989
#3648
#3055

@lejahmie
Copy link
Copy Markdown
Contributor Author

Fixed issues with eslint tests

@jasonsaayman
Copy link
Copy Markdown
Member

Thanks this looks good 😊

@jasonsaayman jasonsaayman merged commit c6ec5fc into axios:master May 12, 2022
@lejahmie
Copy link
Copy Markdown
Contributor Author

@jasonsaayman you can probably close these when this is in;
#3989
#3648
#3055

@jasonsaayman
Copy link
Copy Markdown
Member

Thanks will do

Tiphannie pushed a commit to Tiphannie/axios that referenced this pull request Jul 4, 2025
* Fix Z_BUF_ERROR when no content

* Refactored code

* Fix undefined check

Co-authored-by: Jay <jasonsaayman@gmail.com>
Tiphannie pushed a commit to Tiphannie/axios that referenced this pull request Jul 4, 2025
* Fix Z_BUF_ERROR when no content

* Refactored code

* Fix undefined check

Co-authored-by: Jay <jasonsaayman@gmail.com>
Tiphannie pushed a commit to Tiphannie/axios that referenced this pull request Jul 4, 2025
* Fix Z_BUF_ERROR when no content

* Refactored code

* Fix undefined check

Co-authored-by: Jay <jasonsaayman@gmail.com>
Tiphannie pushed a commit to Tiphannie/axios that referenced this pull request Jul 4, 2025
* Fix Z_BUF_ERROR when no content

* Refactored code

* Fix undefined check

Co-authored-by: Jay <jasonsaayman@gmail.com>
Tiphannie pushed a commit to Tiphannie/axios that referenced this pull request Jul 4, 2025
* Fix Z_BUF_ERROR when no content

* Refactored code

* Fix undefined check

Co-authored-by: Jay <jasonsaayman@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants