Http报头Accept与Content-Type的差别

时间:2023-03-09 19:47:32
Http报头Accept与Content-Type的差别

1.Accept属于请求头。 Content-Type属于实体头。

Http报头分为通用报头,请求报头,响应报头和实体报头。

请求方的http报头结构:通用报头|请求报头|实体报头

响应方的http报头结构:通用报头|响应报头|实体报头

2.Accept代表发送端(client)希望接受的数据类型。

比方:Accept:text/xml;

代表client希望接受的数据类型是xml类型

Content-Type代表发送端(client|server)发送的实体数据的数据类型。

比方:Content-Type:text/html;

代表发送端发送的数据格式是html。

二者合起来,

Accept:text/xml;

Content-Type:text/html

即代表希望接受的数据类型是xml格式,本次请求发送的数据的数据格式是html。

$(function () {
$('pre.prettyprint code').each(function () {
var lines = $(this).text().split('\n').length;
var $numbering = $('

    ').addClass('pre-numbering').hide();
    $(this).addClass('has-numbering').parent().append($numbering);
    for (i = 1; i ').text(i));
    };
    $numbering.fadeIn(1700);
    });
    });