Postmen analog login upload files

Foreword

This article describes the basic usage of the postman, basically covering 80% of the back-end requests usage. Including how to simulate login, send get use postman, post requests, postman upload files, postman download file

New group

Create a new group, the request to hold a project for next debugging.
New group .png

Get request

Get request is relatively simple, basically just fill in the address bar and Parmts parameters, do not make too much description, we will focus on post request
get.png

Post request

Post request we focus on two parts, Headers and Body.

Headers (simulated login request header)

We can achieve simulated log in and send the request by setting the Cookie. We can also set encoding format, analog browser information system model information.
Below, when a direct request system, the system returns to the unregistered. The reason is that the request did not bring the system needs cookie data. We can start with a single sign-in page, by acquiring parameters f12 in Application of cookies, the last set parameters to simulate the login request in the postman's Headers.
image.png

Headers.png

Body (request form)

We use the data submitted the request to mention, the most common way to submit data include:

x-www-form-urlencoded (focus)

Most of the post request using this submission, but he is not suitable for submission flow request.

The data request method will be used URLencoding encoded. Such as Chinese character "D", is encoded UTF8 0xE4B881 in hexadecimal, and finally he will be in a character string "% E4% B8% 81" of the transmission, from the size of 3 bytes into nine bytes. Thus they are not suitable for large-capacity data submission requests.

post.png

multipart / form-data (upload)

Use postman upload files, we first need to switch the format to form-data, followed by the drop-down select File in the right parameters.
Upload file 1.png
Upload file 2.png

download file

Download file .png

Published 33 original articles · won praise 13 · views 10000 +

Guess you like

Origin blog.csdn.net/chaitoudaren/article/details/104833259