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

后端 未结 2 427
日久生厌
日久生厌 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:48

    There is a potential hack here. If your data either has a natrual "=" in it, or you can modify it so that an "=" can be added in some harmless way, you can:

    • Set the forms enctype to text/plain
    • Set a hidden input w/ a name taken from the start of your your data, up to but excluding the first "="
    • Set the input fields value to the byte that follows the "=" until the end of the data.

    Source where I learned about this technique:

    https://systemoverlord.com/2016/08/24/posting-json-with-an-html-form.html

提交回复
热议问题