From 136a07361fd414f5ebf3ef5bc499bb99df3ae50f Mon Sep 17 00:00:00 2001 From: Franz Liedke Date: Fri, 25 Sep 2015 00:35:57 +0200 Subject: [PATCH] Change name of header for faking HTTP methods Refs #502. --- framework/core/src/Api/Middleware/FakeHttpMethods.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/framework/core/src/Api/Middleware/FakeHttpMethods.php b/framework/core/src/Api/Middleware/FakeHttpMethods.php index faae246e7..1ab514a5a 100644 --- a/framework/core/src/Api/Middleware/FakeHttpMethods.php +++ b/framework/core/src/Api/Middleware/FakeHttpMethods.php @@ -16,13 +16,15 @@ use Zend\Stratigility\MiddlewareInterface; class FakeHttpMethods implements MiddlewareInterface { + const HEADER_NAME = 'x-fake-http-method'; + /** * {@inheritdoc} */ public function __invoke(Request $request, Response $response, callable $out = null) { - if ($request->getMethod() === 'POST' && $request->hasHeader('x-http-method')) { - $fakeMethod = $request->getHeaderLine('x-http-method'); + if ($request->getMethod() === 'POST' && $request->hasHeader(self::HEADER_NAME)) { + $fakeMethod = $request->getHeaderLine(self::HEADER_NAME); $request = $request->withMethod(strtoupper($fakeMethod)); }