Fix empty passthrough body replacements - #205
Merged
Merged
Conversation
pimterry
approved these changes
Aug 31, 2026
pimterry
left a comment
Member
There was a problem hiding this comment.
Good find and good fix, thanks! I think I missed this because all my relevant empty cases use buffers, where an empty buffer is indeed truthy.
Member
|
I'll release this later today, I've got a couple of other changes to pull in as well. By the way, in case you're not aware, HTTP Toolkit Pro is free for all contributors to all https://github.com/httptoolkit repos. If that would be useful, just let me know your email (either here or by sending a message to opensource @ httptoolkit.com) and I'll set you up with an account. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Maybe I'm just mistaken, but looked like it wasn't really possible to clear out the request or response body 🤔
The doc/types of these look like this:
and pretty similar description for the response body variant.
Since both
''andundefinedare falsy, it seems like the original body is kept when passing in an empty string.If this is intended behavior, are there other ways to do it? 😊