\Imi\Server\Http\MiddlewareOptionsMiddleware

解决:使用 application/json 请求时,浏览器会先发送一个 OPTIONS 请求

Summary

Methods
Properties
Constants
process()
No public properties found
No constants found
No protected methods found
$allowOrigin
$allowHeaders
$exposeHeaders
$allowMethods
$allowCredentials
N/A
No private methods found
No private properties found
N/A

Properties

$allowOrigin

$allowOrigin : string|null|array<mixed,string>

设置允许的 Origin 为 null 时允许所有 为数组时允许多个

Type

string|null|array<mixed,string>

$allowHeaders

$allowHeaders : string

允许的请求头

Type

string

$exposeHeaders

$exposeHeaders : string

允许的跨域请求头

Type

string

$allowMethods

$allowMethods : string

允许的请求方法

Type

string

$allowCredentials

$allowCredentials : string

是否允许跨域 Cookie

Type

string

Methods

process()

process(\Psr\Http\Message\ServerRequestInterface  $request, \Psr\Http\Server\RequestHandlerInterface  $handler) : \Psr\Http\Message\ResponseInterface

处理方法

Parameters

\Psr\Http\Message\ServerRequestInterface $request
\Psr\Http\Server\RequestHandlerInterface $handler

Returns

\Psr\Http\Message\ResponseInterface