Skip to content

Preserve raw HTTP body whitespace in HTTPTarget#1495

Open
biefan wants to merge 1 commit intoAzure:mainfrom
biefan:preserve-raw-http-body-whitespace
Open

Preserve raw HTTP body whitespace in HTTPTarget#1495
biefan wants to merge 1 commit intoAzure:mainfrom
biefan:preserve-raw-http-body-whitespace

Conversation

@biefan
Copy link
Contributor

@biefan biefan commented Mar 17, 2026

Summary

  • preserve raw request body whitespace in HTTPTarget.parse_raw_http_request()
  • avoid trimming trailing spaces or newlines from text/plain and other non-JSON bodies
  • add regression coverage for raw request bodies with trailing whitespace

Problem

HTTPTarget.parse_raw_http_request() currently calls strip() on the full raw HTTP request before splitting headers from the body.

That means body content is not preserved exactly as provided. For example, a raw request body such as:

hello  

is parsed as:

hello

This silently rewrites non-JSON request bodies and can break plain text, form data, or any scenario where trailing whitespace is significant.

Testing

  • .venv/bin/pytest tests/unit/target/test_http_target_parsing.py -q

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.

1 participant