The format of transmitting parameters in application/x-www-form-urlencoded for axios is incorrect.

use axios to pass parameters. The initial request header is passed in json format without adding format. The backend says that if formdata is needed, add

to axios.
axios.defaults.headers = {
"Content-Type": "application/x-www-form-urlencoded"
}
function fetch(url, params) {
  return new Promise((resolve, reject) => {
      
    axios.post(url, params)
      .then(response => {
        resolve(response.data);
      })
      .catch((error) => {
        reject(error);
      })
  })
}

pass the parameter format as let content = {openid:openid}; then pass content as an argument to the fetch method
, but the format passed is formdata but still looks like a string (not well understood)

clipboard.png

clipboard.png

Sorry for being a little incoherent. Please do me a favor.

Mar.03,2021

https://github.com/axios/axio.


the backend should be able to receive it. The default is axios.defaults.headers.post ['Content-Type'] =' application/x-www-form-urlencoded';

.
Menu