Sending a RAW data POST-request with an HTML Form?

后端 未结 2 429
日久生厌
日久生厌 2020-12-11 01:13

I need to send raw data in the body of a POST request to a Webservice. Can I accomplish this with a HTML form?

Using a standard HTML input field seems to unavoidabl

2条回答
  •  醉话见心
    2020-12-11 01:43

    Can I accomplish this with a HTML form?

    No.

    A form can send either application/x-www-form-urlencoded or multipart/form-data data.

    If you want to use a different data format you have to start looking at JavaScript and XHR (and be subject to the Same Origin Policy and so on).

    You would be better writing your server side code to accept one of the above encodings instead — there are no shortage of libraries that can decode them.

提交回复
热议问题