I have just finished a task on updating the database written in JSON from the front end.
I am still not clarified on the use of headers
which is a type of AxiosConfig
. What is the difference between using axios
with it and without it.
例如:
之间有什么区别
await axios.post(`${URL}/update`, JSON.stringify({urlSlug: apiHash}),
{
headers: {
'content-type': 'application/json'
}
})
).data
和
await axios.post(`${URL}/update`, {apiHash})).data
我尝试了两种方法,但就我而言,只有第一种有效。但是,完成任务后,我仍然还不十分了解它们工作方式的差异。