问题描述
我尝试直接添加二进制文件数据到POST调用的请求主体,所以我可以模拟文件上传。不过,我想设置一个'之前的请求的断点,并使用插入文件,但我似乎无法得到那个工作。我还试图修改CustomRules.js注入该文件,但无法弄清楚如何通过JScript中加载的二进制数据。有一个简单的解决方案吗?
I'm try to add binary file data directly to the request body of a POST call so I can simulate a file upload. However, I tried setting a 'before request' breakpoint and using 'insert file' but I couldn't seem to get that to work. I also tried to modify CustomRules.js to inject the file but couldn't figure out how to load binary data via JScript. Is there an easy solution here?
推荐答案
我敢肯定,这是在今年以来,这一问题被回答了新的功能,但想我无论如何添加:
I'm sure this is a new feature in the year since this question was answered, but thought I'd add it anyhow:
有一个蓝色的[上传文件]的URL文本框下右侧链接作曲了。这将创建一个完整的multipart / form-data的请求。如果你使用这个,你会在体内注意到你现在拥有的东西,看起来像这样:
There's a blue "[Upload file]" link in Composer now on the right side under the URL textbox. This will create a full multipart/form-data request. If you use this, you'll notice in the body you now have something that looks like this:
< @INCLUDE的 C:\\一些\\路径\\ MY-image.jpg文件的@>
<@INCLUDE C:\Some\Path\my-image.jpg@>
在我而言,我只是想直接与没有多部分垃圾POST二进制文件,所以我只是把在&lt;请求体@INCLUDE ... @>魔法,发送二进制文件作为身体
In my case, I just wanted to POST the binary file directly with no multipart junk, so I just put the <@INCLUDE ... @> magic in the request body, and that sends the binary file as the body.
这篇关于提琴手添加二进制文件数据为POST的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!