Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

关于http提交之Content-Type #60

Open
Hibop opened this issue Feb 27, 2019 · 0 comments
Open

关于http提交之Content-Type #60

Hibop opened this issue Feb 27, 2019 · 0 comments

Comments

@Hibop
Copy link
Owner

Hibop commented Feb 27, 2019

一般常见有四种提交方式

1、form-data:

就是http请求中的multipart/form-data,它会将表单的数据处理为一条消息,以标签为单元,用分隔符分开。既可以上传键值对,也可以上传文件。当上传的字段是文件时,会有Content-Type来表名文件类型;content-disposition,用来说明字段的一些信息;

由于有boundary隔离,所以multipart/form-data既可以上传文件,也可以上传键值对,它采用了键值对的方式,所以可以上传多个文件。
image
image

2、x-www-form-urlencoded:

就是application/x-www-from-urlencoded,会将表单内的数据转换为键值对,比如,name=java&age = 23
image
image

3、raw

可以上传任意格式的文本,可以上传text、json、xml、html等
image

4、binary

相当于Content-Type:application/octet-stream,从字面意思得知,只可以上传二进制数据,通常用来上传文件,由于没有键值,所以,一次只能上传一个文件。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant