feat: include request headers in execute response (v0.0.44a33)#426
Merged
Conversation
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
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.
Summary
basic_handlers.py: Inget_request_result, capturedict(resp.request.headers)and store it under therequest_headerskey in the result payload. This usesrequests.PreparedRequest.headersso it reflects the exact headers sent on the wire — including headers added automatically by therequestslibrary (e.g.User-Agent,Accept-Encoding,Content-Length) as well as any custom headers defined in the.httpfile.pyproject.toml: Bump version to0.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
Authorization,X-Custom-Header) and verifyrequest_headersappears in the returned result dictrequest_headersstill appears (with defaultrequestsheaders likeUser-Agent)headers,body,status, etc.) are unaffected