How does axios use this form of request?

this is successful in postman (pictured below), but I don"t know how to write it in axios.

Apr.10,2022

directly above figure:
first of all, I usually encapsulate the api.js and then use the direct call, then getUtils is some fixed parameters, and then in figure 2, the event created in the actions after vuex is used to call the ge or post in the api, or something else. Just define this by yourself, and then take a look at get, which actually passes two parameters, one is the URL of the request, and the other is the parameter of the request. The upload format of specific parameters needs to be negotiated with your colleagues at the backend. It is better to submit with the number of data, such as


just pass the object without serialization directly.
Content-Type: application/json is automatically set when an unserialized js object is passed. Pass the original object directly.
if serialized,
ContentType is automatically set to Content-Type: application/x-www-form-urlencoded becomes a traditional form.
exactly why 400, you need back-end joint debugging.


solved, the parameter body I used is params, put, post, patch should use data:

/ data is the data sent as the body of the request
/ / applies only to these request methods' PUT', 'POST', and' PATCH'
/ / when transformRequest is not set, it must be one of the following types:
/ /-string, plain object, ArrayBuffer, ArrayBufferView, URLSearchParams
/ /-browser exclusive: FormData, File, Blob
/ /-Node exclusive: Stream

  data: {
    firstName: 'Fred'
  },

happens to be used in the project. The data can be serialized with JSON.stringify (the default Content-Type is application/json ).

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3b680-2c29a.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3b680-2c29a.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?