We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When a multipart/form-data request is sent, variables are not replaced in body payload of the request if a file is injected in one part of the form.
It is expected to have variables replaced regardless of what other part is injected in request body. BTW, I find awesome this VSCode extension :)
For following request (with variable AND file injection):
# Import variables # @import ../workdir/variables.http ### POST https://httpbin.org/post Content-Type: multipart/form-data; boundary=WebKitFormBoundary --WebKitFormBoundary Content-Disposition: form-data; name="text" {{projectName}} --WebKitFormBoundary Content-Disposition: form-data; name="invoice"; filename="invoice.pdf" Content-Type: application/pdf < ./dummy.pdf --WebKitFormBoundary--
Response is following
{ "args": {}, "data": "", "files": { "invoice": "1" }, "form": { "text": "{{projectName}}" }, "headers": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate, br", "Content-Length": "238", "Content-Type": "multipart/form-data; boundary=WebKitFormBoundary", "Host": "httpbin.org", "User-Agent": "httpyac", "X-Amzn-Trace-Id": "Root=1-65bc352a-09deb72a513ef6ff60dfffb6" }, "json": null, "origin": "***REDACTED***", "url": "https://httpbin.org/post" }
If request doesn't have file injection, variables replacement work fine. For request (with only variable):
# Import variables # @import ../workdir/variables.http ### POST https://httpbin.org/post Content-Type: multipart/form-data; boundary=WebKitFormBoundary --WebKitFormBoundary Content-Disposition: form-data; name="text" {{projectName}} --WebKitFormBoundary--
Response is:
{ "args": {}, "data": "", "files": {}, "form": { "text": "test" }, "headers": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate, br", "Content-Length": "97", "Content-Type": "multipart/form-data; boundary=WebKitFormBoundary", "Host": "httpbin.org", "User-Agent": "httpyac", "X-Amzn-Trace-Id": "Root=1-65bc357b-7107433c0fd312492c17692b" }, "json": null, "origin": "***REDACTED***", "url": "https://httpbin.org/post" }
Content of ./workdir/variables.http is following:
@projectName=test
The text was updated successfully, but these errors were encountered:
Need to change order of these two lines: https://github.com/AnWeber/httpyac/blob/main/src/plugins/core/registerCorePlugin.ts#L28-L29
Sorry, something went wrong.
fix: Variable is replaced in multipart/form-data when file is injected (
1f936db
AnWeber/vscode-httpyac#258)
cbbff43
#258)
@wiadam thx for your contribution. I released a new version containing the fix.
No branches or pull requests
Problem description
When a multipart/form-data request is sent, variables are not replaced in body payload of the request if a file is injected in one part of the form.
It is expected to have variables replaced regardless of what other part is injected in request body.
BTW, I find awesome this VSCode extension :)
Steps to reproduce
Non functional case
For following request (with variable AND file injection):
Response is following
Functional case
If request doesn't have file injection, variables replacement work fine.
For request (with only variable):
Response is:
Variables file
Content of ./workdir/variables.http is following:
The text was updated successfully, but these errors were encountered: