While constructing requests, you'll work frequently with the request body editor. Postman lets you send almost any kind of HTTP request. The body editor is divided into five areas and has different controls, depending on the body type.web
当构建请求时,你讲常常性地和request body编辑器打交道。Postman容许你发送几乎全部的HTTP请求。body编辑器被分为5部分,有不一样的约束和限制,这取决于body的类型。服务器
Note about Headers: When you are sending requests through the HTTP protocol, your server might expect a Content-Type header. The Content-Type header allows the server to parse the body properly. For form-data and urlencoded body types, Postman automatically attaches the correct Content-Type header so you don't have to set it. The raw mode header is set when you select the formatting type. If you manually use a Content-Type header, that value takes precedence over what Postman sets. Postman does not set any header type for the binary body type.网络
注意请求头Headers: 当你经过HTTP协议发送请求时,你的服务器可能会期待着接收到一个 Content-Type (内容类型) 的请求头。这个Content-Type请求头将使服务器能够恰当地解析请求头。对于 form-data 和 urlencoded 的 body 请求体类型,Postman自动地附带上正确的 Content-Type请求头,因此你没有必要去设置它。raw 模式的 请求体能够在你选择 格式化/排版 类型时选定。 若是你手动地设置一个 Content-Type 请求头,你所设定的值将优先于Postman的设置。Postman不会再 binary 请求头中设置任何请求头类型。app
Postman defaults to 'none' option whenever you send a request. Choose this option if you don't want to send body with your request. If your request has a body, you may choose an appropriate option available there. The default body option appears as below:编辑器
无论你任什么时候候发送一个请求,Postman默认都摸摸人使用 none 选项。若是你不想在你的请求中发送任何请求体,那就选这个选项。若是你的请求确实有请求体,你能够选择一个合适的选项。默认的请求体选项以下:ide
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.post
Uploading multiple files each with their own Content-Type is not supported yet.网站
multipart/form-data
是默认用来转换网络表单为数据的请求体类型。它模拟了在一个网站上填写一个表单,而后进行提交。form-data 编辑器容许你设置 键值对( key-value) (对你的数据使用 data editor)。它一样容许你为multi-part表单请求的每一部分都代表内容类型。你也能够将一个文件加载到一个key上面。当你作那些须要一遍又一遍地发送这些文件的重复性API请求时,Postman为随后的请求保留你的文件路径。这一样能够帮助你运行那些含有须要文件上传的请求集合。ui
This encoding is the same as the one used in URL parameters. You just need to enter key-value pairs and Postman will encode the keys and values properly. Note that you cannot upload files through this encoding mode. There might be some confusion between form-data and urlencoded so make sure to check with your API first.this
这种编码方式和 URL 参数方式是同样的。你只须要输入键值对,Postman就会将这些键值对恰当地编码。注意,你不能经过这种编码方式来上传文件。在 form-data和urlencoded 这两种方式之间可能有些混淆,因此必定要先检查你的API。
A raw request can contain anything. Postman doesn’t touch the string entered in the raw editor except replacing environment variables. Whatever you put in the text area gets sent with the request. The raw editor lets you set the formatting type along with the correct header that you should send with the raw body. You can set the Content-Type header manually too and this will override the Postman defined setting. Selecting XML/JSON in the editor type enables syntax highlighting for your request body and also sets the Content-Type header.
raw(原始) 请求能够包含任何类型的数据。Postman不会接触 输入到 raw 编辑器中的字符串,除非它取代环境变量。无论你在这个文本域中放入什么,它都会被发送到请求中。raw 编辑器容许你设置 带有正确的 请求头 的 排版类型,你应该使用 raw 请求体。你也能够手动地设置 Content-Type 请求头,而这将会改写Postman的设置。在编辑类型中选择XML/JSON可让你的请求体 语法高亮,同时也能够设置 Content-Type请求体。
Tip: Selecting text in the editor and pressing CMD/CTRL + B can beautify the XML/JSON content automatically.
Tip: 在编辑器中选择文本,而后按 CMD/CTRL+B 可让 XML/JSON内容自动地美化。
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.
Binary (二进制) 数据容许你发送不能进入Postman的数据,好比,图片,音频或者视频文件。你也能够发送文本文件。