specify a proxy for a file upload request

56 views
Skip to first unread message

Giorgio Brajnik

unread,
Dec 28, 2022, 6:25:44 AM12/28/22
to mountebank-discuss
Hi there.
I stumbled upon this problem for which I found  no clear answer in available documentation nor by googling around.
I have an http CONSUMER that normally sends to a PROVIDER a PUT request with binary data & multipart/form-data. The provider is expected  to respond with a CREATED code and some json. See below [1] for an example of request.

I need to tell mountebank to act as a proxy, record the request and relay it to the PROVIDER and record the answer back. The problem is that when I do that the provider  answers with a "BAD REQUEST". I suspect because mb should mark its request as "binary".

Am I right? Where should I stick such an option?
Thank you



[1]: { "requestFrom": "::ffff:127.0.0.1:58220", "method": "PUT", "path": "/jobs", "query": {}, "headers": { "{ "requestFrom": "::ffff:127.0.0.1:58220", "method": "PUT", "path": "/jobs", "query": {}, "headers": { "Host": "localhost:42579", "User-Agent": "python-requests/2.28.1", "Accept-Encoding": "gzip, deflate", "Accept": "*/*", "Connection": "keep-alive", "Content-Length": "142577", "Content-Type": "multipart/form-data; boundary=0dfabfb03336cccc5a619c1e11bce9d1" }, "body": "--0dfabfb03336cccc5a619c1e11bce9d1\r\nContent-Disposition: form-data; name=\"main\"\r\n\r\nscript.sh\r\
TRUNCATED
--0dfabfb03336cccc5a619c1e11bce9d1--\r\n", "ip": "::ffff:127.0.0.1", "timestamp": "2022-12-28T10:52:35.218Z" }
Reply all
Reply to author
Forward
0 new messages