WebAPI学习笔记(8)Postman中Binary和Form-data上传文件区别

官方解释如下:

Binary data

Binary data allows you to send things which you can not enter in Postman, for example, image, audio, or video files. You can send text files as well.

Form-data

multipart/form-data is the default encoding a web form uses to transfer data. This simulates filling a form on a website, and submitting it. The form-data editor lets you set key-value pairs (using the data editor for your data.) It also lets you specify the content type for each part of a multi-part form request individually. You can attach files to a key as well.

When you repeatedly make API calls that require sending these files again and again, Postman persists your file paths for subsequent use. This also helps you run collections that contain requests requiring file upload.

Uploading multiple files each with their own Content-Type is not supported yet.

主要区别在于:

1. Binary每次只能传一个附件,而Form-data可以传多个。

2. Form-data可以利用key-value对,可以分别对每个文件进行描述。

原文地址:https://www.cnblogs.com/61007257Steven/p/11956379.html