![](/img/trans.png)
[英]Node.js Axios POST request with application/x-www-form-urlencoded format?
[英]Axios post form urlencoded requests application/x-www-form-urlencoded
我正在嘗試使用 axios 發送請求帖子,從復選框發送該帖子數據並提交按鈕,但我不知道如何使用 axios 正確執行此操作,非常感謝您的幫助`
const URI = "https://www.guadeloupe.gouv.fr/booking/create/12828/0"
const data = "condition=on&nextButton=Effectuer+une+demande+de+rendez-vous"
const headers = {
'Content-Type': 'application/x-www-form-urlencoded',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36',
'Accept-Encoding': 'gzip, deflate, br',
'Origin': 'https://www.guadeloupe.gouv.fr'
}
const resp = await axios.post(URI,data,headers)
失眠 = INSONMIA POST REQUEST SCREEN SHUT
復選框 =照片復選框提交
我無法使用真正的 REST 服務器進行測試,但我可以建議使用此代碼。
它基於您的圖像和代碼。
const resp = await axios.post(URI,
new URLSearchParams({
'condition': 'condition',
'nextButton': 'Effectuer une demande de rendez vous'
}),
{
headers:
{
'Content-Type': 'application/x-www-form-urlencoded'
}
})
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.