bruno
bruno copied to clipboard
[Bug] Variables in the body with multipat form type.
Variables are not inserted into the body with multipat form type.
mock return request body
Seems similar to #329, I'll see if this is the same kind of quick and easy fix.
Sorry, it's a bit more difficult fix - by the time we are interpolating things, we are already using Axios magic
{
"method": "POST",
"url": "http://google.com",
"headers": {
"content-type": "multipart/form-data; boundary=--------------------------197003115612960382152288"
},
"data": {
"_overheadLength": 206,
"_valueLength": 11,
"_valuesToMeasure": [],
"writable": false,
"readable": true,
"dataSize": 0,
"maxDataSize": 2097152,
"pauseStreams": true,
"_released": false,
"_streams": [
"----------------------------197003115612960382152288\r\nContent-Disposition: form-data; name=\"whatever\"\r\n\r\n",
"{{someVar}}",
null,
"----------------------------197003115612960382152288\r\nContent-Disposition: form-data; name=\"\"\r\n\r\n",
"",
null
],
"_currentStream": null,
"_insideLoop": false,
"_pendingNext": false,
"_boundary": "--------------------------197003115612960382152288"
},
"script": {},
"vars": {},
"assertions": [],
"cancelToken": {
"promise": {}
}
}
To fix this we'd need to either:
- dig through the guts here, it might be that just interpolating
_streams
is enough (we already dig in the guts of json, andx-www-form-urlencoded
bodies, but here you need to make sure that it works in all cases) - interpolate it first and then feed it through axios, but there is some conditional logic in between that needs some love, and there's a lot of manual testing to get things right
It's not very complicated, just requires more time than I have at the moment.
I love Bruno's design and integration with projects/repos. I would've incorporated it into my project today if I hadn't run into this. Very much looking forward to this fix.
Same here, looking forward to this fix!
Yes, same here indeed: it would be much more elegant to be able to.
Any progress on this issue?
Any progress on this issue?
Not really. I try (or somebody else) to look into it the next few days. But i think it should be a relatively easy fix™.
Thanks for taking the time @Its-treason. I'll build it locally to try the fix 👀
@peauc Any progress?
Just ran into this, looking forward to this being fixed
Same here, I will probably find a workaround using axios directly however looking forward to the fix
Having same issue. You can do the following (.bru file):
...
headers {
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW
}
body:text {
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="grant_type"
client_credentials
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="client_id"
{{MyClientId}}
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="client_secret"
{{MyAppSecret}}
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="resource"
{{MyResource}}
------WebKitFormBoundary7MA4YWxkTrZu0gW--
}
...
This example has 4 parts:
- grant_type
- client_id
- client_secret
- resource
I have the same issue, Is it possible to get a solution for this bug?
For those looking for a workaround in the meantime, switching to body type 'Form URL Encoded' and adding the same params with variables there worked for me.
@lohxt1 Assigning this to you. Please get to speed on this issue and lets review @Its-treason PR if we can get to a solution that does not involve a breaking change
Any updates?
there is a pr that fixes this issue. it resolves the multipart form data interpolation issue without introducing any breaking change, the approach taken here involves deconstructing the form data and recreating it back using the interpolated values. the pr is yet to be reviewed
For those looking for a workaround in the meantime, switching to body type 'Form URL Encoded' and adding the same params with variables there worked for me.
This doesn't work for me, using Bruno CLI
@sanjai0py
Any updates please team? I'm using latest Bruno, no joy.
Also running into this issue. The work around to use "Form URL Encoded" won't work for me as I need to upload a file 😢 thanks to everyone working on this, #2329 seems promising!
I have the same issue, would love to have a fix or a workaround that allows to upload files while using variables
Loving Bruno - this bug is painful for me right now.
Yes! This bug is really painful.
Is there any update on this? This bug is frustrating.