Repository navigation
fix: keep {{variables}} whole in the request line - #18
Merged
Merged
Conversation
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.
A request line in a
.httpfile was split into words before its variables were filled in. Any{{...}}with a space inside it broke the line:{{ name }}, with spaces inside the braces, failed the same way.run --helpadvertises{{$processEnv NAME}}, and an agent using timeline hit this and had to switch to{{NAME}}instead.The fix
requestLinesplits the line with a small regex (word) that keeps each{{...}}whole, in place ofstrings.Fields. Variables are still filled in after the split, as before.?/&continuation lines and bodies weren't affected, since they're filled in before anything splits them.{{falls back to splitting on spaces, asstrings.Fieldsdid.Tests
TestParseHTTPVariablesgains a request line with both forms:POST {{$processEnv HOST_URL}}/{{ version }} HTTP/1.1. It failed before the change (got 5 words) and passes now.Tested with
go test -race ./.... The built binary also sentPOST {{$processEnv AUTH_URL}}/login HTTP/1.1to a local server.