Postman - the basic component of HTTP requests

Generally speaking, all HTTP Requests have four basic parts: URLMethodHeadersand body.

(1)Method

It is very simple to choose the Request Method. Postman supports all request methods.

(2)URL

To assemble a Request, the URL is always the first thing you need to fill in. In Postman, the URL you have entered can be automatically completed through the drop-down menu.

Take the Get request as an example:

If you click the Params tab, Postman will display the "Key Value" editing interface, where you can enter the Parameter of the URL, and Postman will automatically add it to the URL for you.

On the other hand, if your URL already has parameters, Postman will automatically load the parameters in the "Key Value" editing interface.

现在我也找了很多测试的朋友,做了一个分享技术的交流群,共享了很多我们收集的技术文档和视频教程。
如果你不想再体验自学时找不到资源,没人解答问题,坚持几天便放弃的感受
可以加入我们一起交流。而且还有很多在自动化,性能,安全,测试开发等等方面有一定建树的技术大牛
分享他们的经验,还会分享很多直播讲座和技术沙龙
可以免费学习!划重点!开源的!!!
qq群号:110685036

(3)Headers

Click on Headersthe label, and Postman will also display a "key value" editing interface. Here, you can add whatever you want Header attribute(request header parameters). Similarly, Postman has provided us with a very considerate auto-completefunction. By typing a letter, you can select the standard you want from the drop-down menu atrribute. At the same time, when we use Postman, the request header is automatically generated based on the form of the request parameters.


(4)body

If the Request we want to create is a submission similar to a POST request, then we need to edit the Request Body. The body of the POST request can store any content format, and the browser can content-typeparse the request body according to the type specified in the request header.

Postman body typeprovides 6 editing methods according to different types:

  1. form-data
  2. x-www-form-urlencoded
  3. raw
  4. binary
  5. GraphQL
  6. none

illustrate

form-data

Submit data in the form of key-value pairs.

For a piece of utf8-encoded byte data, directly splice the utf8-encoded bytes into the request body, and send as many bytes as there are locally, which greatly improves efficiency and is suitable for transmitting long bytes.

Therefore the format should be used when transferring very long bytes (such as files) multipart/form-data.

Summarize:

  • Submitted form data is not character-encoded.
  • This value is recommended when using forms that contain file upload controls.
  • You can upload key-value pairs or files.
  • Multiple files can be uploaded.

x-www-form-urlencoded

It is the default format submitted by Post. All characters are encoded before sending data. ASCII character encoding is used, and non-ASCII characters are percent-encoded. Therefore, the transmission efficiency for non-ASCII characters is very low.

The data in the form will be converted into key-value pairs, and the key-value pairs are separated by &. Use this option when you need to simulate a form to upload data.
However, this form cannot upload files, only text format.

Summarize:

Also using URLencode transcoding, the difference between the Post request method and the Get request method is:

  • The Get request method uses the converted and spliced ​​string ?directly connected to the form's action as the URL, so there is no data in the request body.
  • The Post request method puts the converted and spliced ​​string in the request body and will not be displayed in the browser's address bar, so it is safer.

raw

Text type data in any format can be uploaded. The text is transmitted to the server without any modification . Text, json, xml, html, etc. can be uploaded. In fact, the main thing is to transfer data in json format. When the backend requires json data format, this format must be used for testing.

binary

Equivalently Content-Type:application/octet-stream, only secondary data can be uploaded. It is usually used to upload files, but only one file can be uploaded at a time.

GraphQL

Compared with the RESTFUL architecture solution, GraphQL pays more attention to the interface level and is a brand-new interface specification. For interfaces that comply with the GraphQL interface specification, we can choose to use GraphQL for Post submission.

none

No data submitted.

Finally, I would like to thank everyone who read my article carefully. Looking at the increase in fans and attention, there is always some courtesy. Although it is not a very valuable thing, if you can use it, you can take it directly!

Software Testing Interview Document

We must study to find a high-paying job. The following interview questions are from the latest interview materials from first-tier Internet companies such as Alibaba, Tencent, Byte, etc., and some Byte bosses have given authoritative answers. After finishing this set I believe everyone can find a satisfactory job based on the interview information.
 

Insert image description here

Guess you like

Origin blog.csdn.net/IT_LanTian/article/details/132811723