Skip to content

feat: include request headers in execute response (v0.0.44a33)#426

Merged
cedric05 merged 1 commit into
mainfrom
pk-headers
Jun 12, 2026
Merged

feat: include request headers in execute response (v0.0.44a33)#426
cedric05 merged 1 commit into
mainfrom
pk-headers

Conversation

@cedric05

Copy link
Copy Markdown
Owner

Summary

  • basic_handlers.py: In get_request_result, capture dict(resp.request.headers) and store it under the request_headers key in the result payload. This uses requests.PreparedRequest.headers so it reflects the exact headers sent on the wire — including headers added automatically by the requests library (e.g. User-Agent, Accept-Encoding, Content-Length) as well as any custom headers defined in the .http file.
  • pyproject.toml: Bump version to 0.0.44a33.

Why

Previously the execute response only contained response headers (resp.headers). The VS Code notebook renderer (dothttp-runner) had no way to display what was actually sent in the request, making it harder to debug authentication issues, content-type mismatches, etc.

Test plan

  • Run a request with custom headers (e.g. Authorization, X-Custom-Header) and verify request_headers appears in the returned result dict
  • Run a request with no custom headers and verify request_headers still appears (with default requests headers like User-Agent)
  • Verify existing response fields (headers, body, status, etc.) are unaffected

Previously the execute response only contained response headers. The
request headers (Authorization, Content-Type, User-Agent, and any custom
headers set in the .http file) were never serialised into the result
payload, so the VS Code notebook renderer had no way to display them.

Changes:
- basic_handlers.py: in `get_request_result`, capture
  `dict(resp.request.headers)` and store it under the `request_headers`
  key in the result. Uses PreparedRequest headers so it reflects the
  exact headers sent on the wire, including headers added automatically
  by the `requests` library (e.g. User-Agent, Accept-Encoding,
  Content-Length).
- pyproject.toml: bump version to 0.0.44a33
@cedric05 cedric05 merged commit ecef303 into main Jun 12, 2026
5 checks passed
@cedric05 cedric05 deleted the pk-headers branch June 12, 2026 07:26
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