用HTML表单发送RAW数据POST请求? [英] Sending a RAW data POST-request with an HTML Form?

查看:1707
本文介绍了用HTML表单发送RAW数据POST请求?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要将POST请求正文中的原始数据发送到Web服务。我可以使用HTML表单完成此操作吗? 使用标准的HTML输入字段似乎不可避免地会产生一个形式为< name_of_input_field> =< DATA> ,而我只想发布< DATA>

我是否需要使用javascript来执行此请求?

解决方案

< blockquote>

我可以用HTML表单完成这项工作吗?


$ b

表单可以发送application / x-www-form-urlencoded或multipart / form-data数据。

<如果您想使用不同的数据格式,您必须开始查看JavaScript和XHR(并遵守相同原产地政策等)。



您最好是编写你的服务器端代码来接受上面的编码之一 - 不缺少可以解码它们的库。


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 unavoidably generate a POST body of the form <name_of_input_field>=<DATA> whereas I would simply like to post <DATA>.

Do I need to resort to performing this request with javascript?

解决方案

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.

这篇关于用HTML表单发送RAW数据POST请求?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆