Post request the difference between the back -end Body and Query

tags: javascript  Front -end request

mistake: Required request parameter ‘username’ for method parameter type String is not present

reason: The request parameter type specified in the back -end is query, and I use Body.
POST requests that both Query and Body can pass the parameters. The Query parameters are fighting on the request address, and the value of the params can only be a string, which cannot pass the parameters of the object type. Body biography.

before fixing:

export function login(data) {
  debugger
  return request({
    url: '/api/v1/tcp/auth/login',
    method: 'post',
    data:data
  })
}

After modification:

export function login(data) {
  debugger
  return request({
    url: '/api/v1/tcp/auth/login',
    method: 'post',
    params:data
  })
}

Intelligent Recommendation

Baidu translation of crawler (with the function of __init__ function, the difference between GET request header and POST request body, sys.argv[1] for python function learning)

Baidu translation example: Knowledge link: The role of __init__ initialization >>>> Knowledge link: the difference between GET request header and POST request body >>>> Knowled...

How to send the request when there is a query parameter and a body parameter in the post request

Today I received a new interface, which requires query parameters and body parameters. (Similar to this) By finding articles and combining your own projects, the final solution is as follows:...

Request scheme when POST request, parameter body type, and Query types

Requirements: An interface is, POST request, request head content-type: "Application / JSON", request parameter type has two kinds of Body and Query. 1. First encapsulate the API interface: ...

Record the process of spring-cloud-gateway obtaining the post request body parameters and the response parameters processed by the back-end service gateway:2.2.0.RELEASE

Introduce the framework version I found many versions of the code on the Internet, but it didn't work. Either the body data could not be obtained, or after the request was repackaged to the back-end s...

The difference between get request and post request in Ajax

Form form elements provide two ways to transfer data - get and post. Although they are all data submission methods, they do make a big difference in actual transmission. The get and post methods in th...

More Recommendation

Get the difference between Ajax request Post request

Transfer from: http: //www.cnblogs.com/oneword/archive/2011/06/06/2073533.html Get and Post request request difference 1. When using the Get request, displayed in the URL parameters, and using the Pos...

get the difference between the request and post a request

At the same: to submit all data to a remote server Differences: different locations submitted Scenarios...

In the HTTP get request and the difference between the post request

1.get (default) value is transmitted form by its URL, the action attribute data added later; post form values ​​are passed to the hidden http packet body, url visible. 2.get passing the form through u...

The difference between GET request and POST request

Blog reference to the summary made by w3school First understand what is HTTP? HTTP, also known as the Hypertext Transfer Protocol, is the most widely used network protocol on the Internet. The working...

The difference between post request and get request

The get request is generally to display class data or data query Post is generally used when logging in. Logging in generally requires verification of the token. It is better to use post. Basically al...

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

Top