使用 Postman 上传文件测试 [英] Upload file test with Postman

查看:53
本文介绍了使用 Postman 上传文件测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Postman 测试将文件上传到 SharePoint Online.在我的 post 请求中,我将 body 设置为 form-data 并添加一个带有名为 a.txt 的文本文件的文件参数.文本文件包含文本

I am testing a file upload to SharePoint online with Postman. In my post request I set the body to form-data and add a file param with a text file called a.txt. The text file contains the text

one
two
three

当我执行请求时我的文件被上传但是当我打开文件时内容是

When I execute the request my file is uploaded but when I open the file the contents is

----------------------------235004993628819232914336
Content-Disposition: form-data; name="file"; filename="a.txt"
Content-Type: text/plain

one
two
three
----------------------------235004

我尝试将 Content-Type 标头设置为

I have tried setting the Content-Type header to

application/x-www-form-urlencoded或者多部分/表单数据

application/x-www-form-urlencoded or multipart/form-data

但没有运气

推荐答案

请按照以下步骤操作-

1. Go to the body of the API
2. pass the parameter or key
3. When you pass the key you have a option of value of Text/File like below
4.Choose the file from
5. Click on send.
6. Get your response.

希望这对朋友有帮助.

这篇关于使用 Postman 上传文件测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆