Content-Type介绍

Content-Type介绍

请求头中的Content-Type

  • 作用: 告诉服务器实际发送的数据类型
  • 常见类型:
    1. application/x-www-form-urlencoded;
    2. multipart/form-data; 常用于上传文件, 支持二进制格式
    3. application/json;
    4. text/plain; 很少用

响应头中的Content-Type

  • 告诉客户端实际返回的内容的内容类型
  • 常见类型:
    1. application/json;
    2. text/html;
    3. text/plain;
    4. image/png;
    5. application/octet-stream; 文件下载