对于 HTTP OPTIONS 请求,获得响应 body 有什么意义吗?
For an HTTP OPTIONS request, is there any point in having a response body?
目前,如果我回复选项请求,则无需发送任何我知道的回复body,只需headers 表明我将接受什么
<?php
header("Access-Control-Allow-Origin: example.com");
header("Access-Control-Allow-Methods: OPTIONS, GET, POST, PUT");
header("Access-Control-Allow-Headers: API-Key, Query-Sequence");
header("Access-Control-Expose-Headers: Query-Sequence");
if($_SERVER['REQUEST_METHOD'] == 'OPTIONS'){
die;
}
//....
但是 body 会被用于某些事情吗?
The response body, if any, SHOULD also include information about the
communication options. The format for such a body is not defined by
this specification, but might be defined by future extensions to HTTP.
您可以包含它,如果您这样做,它可能应该是对允许的选项的简单英语描述。不过这样做没有多大意义。
目前,如果我回复选项请求,则无需发送任何我知道的回复body,只需headers 表明我将接受什么
<?php
header("Access-Control-Allow-Origin: example.com");
header("Access-Control-Allow-Methods: OPTIONS, GET, POST, PUT");
header("Access-Control-Allow-Headers: API-Key, Query-Sequence");
header("Access-Control-Expose-Headers: Query-Sequence");
if($_SERVER['REQUEST_METHOD'] == 'OPTIONS'){
die;
}
//....
但是 body 会被用于某些事情吗?
The response body, if any, SHOULD also include information about the communication options. The format for such a body is not defined by this specification, but might be defined by future extensions to HTTP.
您可以包含它,如果您这样做,它可能应该是对允许的选项的简单英语描述。不过这样做没有多大意义。