mirror of
https://github.com/flarum/framework.git
synced 2025-05-28 02:40:00 +08:00
Rename HTTP method override header
This is the name recommended by the JSON-API spec: http://jsonapi.org/recommendations/#patchless-clients
This commit is contained in:
@ -191,11 +191,11 @@ export default class App {
|
|||||||
options.background = options.background || true;
|
options.background = options.background || true;
|
||||||
|
|
||||||
// If the method is something like PATCH or DELETE, which not all servers
|
// If the method is something like PATCH or DELETE, which not all servers
|
||||||
// support, then we'll send it as a POST request with a the intended method
|
// and clients support, then we'll send it as a POST request with the
|
||||||
// specified in the X-Fake-Http-Method header.
|
// intended method specified in the X-HTTP-Method-Override header.
|
||||||
if (options.method !== 'GET' && options.method !== 'POST') {
|
if (options.method !== 'GET' && options.method !== 'POST') {
|
||||||
const method = options.method;
|
const method = options.method;
|
||||||
extend(options, 'config', (result, xhr) => xhr.setRequestHeader('X-Fake-Http-Method', method));
|
extend(options, 'config', (result, xhr) => xhr.setRequestHeader('X-HTTP-Method-Override', method));
|
||||||
options.method = 'POST';
|
options.method = 'POST';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ use Zend\Stratigility\MiddlewareInterface;
|
|||||||
|
|
||||||
class FakeHttpMethods implements MiddlewareInterface
|
class FakeHttpMethods implements MiddlewareInterface
|
||||||
{
|
{
|
||||||
const HEADER_NAME = 'x-fake-http-method';
|
const HEADER_NAME = 'x-http-method-override';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
|
Reference in New Issue
Block a user