HTTP: Key-Value-Pairs in POST-Parameters (in URL) or Headerfield

时间:2018-01-11 08:42:55

标签: http url post header key-value

I am looking for a way to send Key-Value pairs from a client to a server using http (POST). What of the both possibilities would you recommend and why? Does the size of the respective URL or header-field matter (what are the sizes exactly, are there any definitions?)? Thanks in advance.

1 个答案:

答案 0 :(得分:0)

当浏览器从标准HTML表单发送POST时,它们发送的参数和值实际上是键值对 - 作为POST请求的主体。其标准格式包括标准分隔符,例如object=triangle&chosen+action=flip,如果您的密钥或值包含它们,则需要转义。用于提取参数的标准HTTP库将会出现这种情况,并且对长度的任何限制都将特定于这些库和服务器规范。但是,在POST请求的主体中使用任何格式的数据是完全可以接受的。这些约定实际上更符合HTML标准。