commit b966b122bb6db1553118f2884cb548e3e86bb08c Author: Clemens Tolboom Date: Sat Oct 11 14:57:16 2014 +0200 #26 diff --git a/core/modules/rest/src/Routing/OptionsRequestSubscriber.php b/core/modules/rest/src/Routing/OptionsRequestSubscriber.php index 292885b..6298cf3 100644 --- a/core/modules/rest/src/Routing/OptionsRequestSubscriber.php +++ b/core/modules/rest/src/Routing/OptionsRequestSubscriber.php @@ -75,7 +75,14 @@ public function onKernelRequest(GetResponseEvent $event) { $request = $event->getRequest(); if ($request->isMethod('OPTIONS')) { $allowed_methods = implode(' ', $this->getAllowedMethods($request)); - $response = new Response(NULL, 200, array('Allow' => $allowed_methods)); + $accepts = $request->getAcceptableContentTypes(); + $accept = array_shift($accepts); + $headers = array( + 'Allow' => $allowed_methods, + // TODO use $accept instead + 'Content-Type' => $request->getMimeType('json'), + ); + $response = new Response(NULL, 200, $headers); $event->setResponse($response); $event->stopPropagation(); } @@ -102,7 +109,7 @@ protected function getAllowedMethods(Request $request) { * {@inheritdoc} */ public static function getSubscribedEvents() { - $events[KernelEvents::REQUEST][] = array('onKernelRequest', 1000); + $events[KernelEvents::REQUEST][] = array('onKernelRequest', 32); return $events; }