简体   繁体   English

Axios post form urlencoded 请求 application/x-www-form-urlencoded

[英]Axios post form urlencoded requests application/x-www-form-urlencoded

I'm trying to make a requests post with axios, sending that postdata from a checkbox and submit button, but I don't know how to do this correctly with axios, I would appreciate your help `我正在尝试使用 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)

with insomnia = INSONMIA POST REQUEST SCREEN SHUT失眠 = INSONMIA POST REQUEST SCREEN SHUT

CHECKBOX = PHOTO CHECKBOX SUBMIT复选框 =照片复选框提交

I can't test with real REST server but I can suggest this code.我无法使用真正的 REST 服务器进行测试,但我可以建议使用此代码。

It's base on your image and code.它基于您的图像和代码。

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.

相关问题 具有 application/x-www-form-urlencoded 格式的 Node.js Axios POST 请求? - Node.js Axios POST request with application/x-www-form-urlencoded format? 使用 axios 发出 x-www-form-urlencoded 请求 - Making a x-www-form-urlencoded request with axios 使用“Content-Type”:“application/x-www-form-urlencoded”从 axios 发送帖子请求会给出 401 Unauthorized 响应 - Sending post request from axios with "Content-Type" : "application/x-www-form-urlencoded" gives an 401 Unauthorized response 包含ascii字符的POST请求[x-www-form-urlencoded] - POST request containing ascii characters [x-www-form-urlencoded] 如何使用 Axios 在 application/x-www-form-urlencoded 中编码 JSON 数据? - How to encode JSON data in application/x-www-form-urlencoded using Axios? 解析ExpressJS中的application / x-www-form-urlencoded - Parsing application/x-www-form-urlencoded in Expressjs 如何使用“内容类型”:“ application / x-www-form-urlencoded”发出发布请求? - How to make a Post request with “content type”: “application/x-www-form-urlencoded”? 使用application / x-www-form-urlencoded使用node.js在发布请求中发送数组 - Send Array in post request using node.js using application/x-www-form-urlencoded 如何使用同构提取使用application / x-www-form-urlencoded标头和URLSearchParams进行POST - How to POST with application/x-www-form-urlencoded header and URLSearchParams using isomorphic-fetch 如何在节点js中使用参数为application / x-www-form-urlencoded类型的POST调用 - How to consume POST call where parameter is of type application/x-www-form-urlencoded in node js
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM