Body and query parameter passing in front-end request

The most commonly used front-end sending requests are get requests and post requests

The get request can only pass the query parameter, and the query parameter is spliced ​​on the request address.
Post can pass body and query parameters.

The parameters transmitted in the url of the get request are limited in length, but there is no limit in the post.
get is less secure than post, because the parameters are directly exposed on the url, so they cannot be used to pass sensitive information.

The parameters of data->body
params->query are spliced ​​into the browser address

query refers to the parameters of the request, generally refers to the URL? parameters that follow.
For example, pretty=true in http://10.6.6.6:8080/api/v1/namespaces?pretty=true is query

Get method:

form-data request data type
Interface documentation for the get method
The query parameter of the get method
Parameters are spliced ​​to the path
insert image description here
Use template strings to splice parameters to the path
insert image description here

Post method:

JSON request data type
Interface documentation for the post method
The body parameter in the post method
form-data request data type
insert image description here
insert image description here
The request type has both query and formData
insert image description here

data corresponds to formData data, and params corresponds to query data.
insert image description here

Guess you like

Origin blog.csdn.net/weixin_45288172/article/details/127507520