Q:
So the accept header tells the server the mime-type of the resource the browser is looking for. For example, the server can send plain text, html, json, etc. Ok that makes sense. But then I look at the content-type header and it looks to be doing the same thing. For example, it tells the server that it wants text or json. So then what's the difference?
A:
As you correctly note, the Accept header is used by HTTP clients to tell the server what content types they'll accept. The server will then send back a response, which will include a Content-Type header telling the client what the content type of the returned content actually is.
However, as you may have noticed, HTTP requests can also contain Content-Type headers. Why? Well, think about POST or PUT requests. With those request types, the client is actually sending a bunch of data to the server as part of the request, and the Content-Type header tells the server what the data actually is (and thus determines how the server will parse it).
In particular, for a typical POST request resulting from an HTML form submission, the Content-Type of the request will normally be either application/x-www-form-urlencoded or multipart/form-data.
参考:
http://webmasters.stackexchange.com/questions/31212/difference-between-accept-and-content-type-http-headers
分享到:
相关推荐
modify-http-headers Chrome插件, 测试可用,包含插件安装文档
linux-hwe-5.4-headers-5.4.0-152_5.4.0-152.169~18.04.1_all.deb
compat-glibc-headers-2.3.2-95.30.i386
linux-libc-headers-2.6.12.0.tar.bz2是linux的头文件库,在建立交叉编译链时会用到。
nv-codec-headers-master.zip
django-cors-headers
compat-glibc-headers-2.5-46.2.i686.rpm是centos工具包。
linux-api-headers-git 清理了用于用户空间的内核头
前端开源库-markdown-it-lazy-headersMarkdown it Lazy Headers,Lazy ATX Headers插件用于Markdown it
FFmpeg Delphi/Pascal Headers and Examples Ported from FFmpeg 4.1.4 Tested on Delphi 6 to Delphi 10.3 Rio and FPC 3.0.2 (Win32 only) \CompilerDefines.inc .......\FFTypes.pas .......\...
Laravel开发-secure-headers 向HTTP响应添加安全相关的头。该软件包包括便于Laravel集成的服务提供商。
VLC 播放器,涉及到ffmpeg,视频播放等,是pascal 的使用实例delphi 头源码,欢迎使用
离线安装包,亲测可用
iphone-sdk-2.0-headers 别看的不大 我坚持了一天 1k 1k的下下来的
ffmpeg编译支持硬编码时用到的,备份一下 。
headers-more-nginx-module-0.34
( defun my :ac-c-headers-init () (require 'auto-complete-c-headers) (add-to-list 'ac-sources 'ac-source-c-headers)) (add-hook 'c++-mode-hook 'my:ac-c-headers-init) (add-hook 'c-mode-hook 'my:ac-c-...
Kernel-devel-headers-x86-64
kernel-plus-headers-3.10.0-1160.41.1.el7.centos.plus.x86_64.rpm
auto-complete-c-headers-源码.rar