The difference between body and query parameters in front-end post requests

The most commonly used front-end requests are get requests and post requests
Get request can only pass query parameters, query parameters are all spelled on the request address
post can pass parameters in two forms: body and query
as follows:

/* Edit item list */
export function editProjectList(params) {
  const url = '/support/project/update';
  return request({
    url: url,
    method: 'put',
    data: params // data is the body parameter
  });
}


/* Add customer list */
export function addClientList(params) {
  const url = '/support/company/insert';
  return request({
    url: url,
    method: 'post',
    params: params// params are query parameters
  });
}

Note: The parameter passing on the request address is the query passing parameter. The value of params can only be a string, and the parameter of the object type cannot be passed. If the passing object is involved in the parameter, the body passing parameter must be selected.

Intelligent Recommendation

Spring Security requests cross-domain solution + front-end send POST request, body is NULL

The front end is uniapp Because we are the project separated by the front and rear end, I found the problem when I finished the login interface. It is also very convenient to solve it. Add the followi...

The difference between POST and GET requests

 https://www.cnblogs.com/logsharing/p/8448446.html        You easily given a "standard answer": GET is harmless when the browser is rolled back and the POST request will be su...

The difference between GET and POST requests

1, GET request, the requested data will be appended to the URL, to? URL and transmit the divided data, a plurality of parameters & connect. URL encoding format uses ASCII encoding instead uniclde,...

The difference between front ++ and post ++

The calculation effects of the pre-++ and post-++ are both the operand self-increase. There is no difference when it is a single statement, but if used in an expression: i++ means first take the value...

get the difference between requests and post requests

No way get request body post embodiment thereof there is a request 1. Different delivery methods: Users will get the data in the browser's address bar form clock input clock sent to the server, format...

More Recommendation

Basic difference between get requests and post requests

Basic difference between get requests and post requests Get request: Post request:...

The difference between get requests and post requests in AXIOS

The difference between get requests and post requests in AXIOS 1. Interface writing 2. Page request Get request parameters will be stitched, query string parameters Post request parameters will not be...

The front end uses the POST requests the background, the parameters cannot be received with @RequestParam parameters

JAVA front-end POST request, parameter cannot be received here to write custom directory headings with @RequestParam parameters When the front end is requested with GET request, the interface is used ...

The difference between the Get request and the Post request in the client (front end) Ajax

When we use Ajax, when we send data to the server, we can use the Get method to request the server, or use the Post method to request the server. So, what is the difference between the Get request and...

Front-end learning notes - the difference between GET and POST, when is it used?

Back to Contents First, difference Second, when will I use? refer to:Link...

Copyright  DMCA © 2018-2026 - All Rights Reserved - www.programmersought.com  User Notice

Top