Skip to content

Fix empty passthrough body replacements - #205

Open
oskstr wants to merge 1 commit into
httptoolkit:mainfrom
oskstr:fix-empty-replacement-bodies
Open

Fix empty passthrough body replacements#205
oskstr wants to merge 1 commit into
httptoolkit:mainfrom
oskstr:fix-empty-replacement-bodies

Conversation

@oskstr

@oskstr oskstr commented Aug 29, 2026

Copy link
Copy Markdown

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:

    /**
     * A string or buffer that replaces the request body entirely.
     *
     * If this is specified, the upstream request will not wait for the original request
     * body, so this may make responses faster than they would be otherwise given large
     * request bodies or slow/streaming clients.
     */
    replaceBody?: string | Uint8Array | Buffer;

and pretty similar description for the response body variant.

Since both '' and undefined are 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? 😊

@CLAassistant

CLAassistant commented Aug 29, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

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