mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
NEW: Register Injector::inst()->get(HTTPRequest)
HTTPRequest is provided as a service so that global references for session, hostname, etc can be facilitated. It’s a bit of a hack and should be avoided but we’re unlikely to scrub it completely from the Silverstripe 4 code.
This commit is contained in:
parent
10866c0809
commit
4d89daac78
@ -304,6 +304,8 @@ class Director implements TemplateGlobalProvider
|
||||
*/
|
||||
public static function handleRequest(HTTPRequest $request)
|
||||
{
|
||||
Injector::inst()->registerService($request, HTTPRequest::class);
|
||||
|
||||
$rules = Director::config()->uninherited('rules');
|
||||
|
||||
// Get global middlewares
|
||||
@ -376,11 +378,15 @@ class Director implements TemplateGlobalProvider
|
||||
}
|
||||
|
||||
// Call the handler with the given middlewares
|
||||
return self::callWithMiddlewares(
|
||||
$response = self::callWithMiddlewares(
|
||||
$request,
|
||||
$middlewares,
|
||||
$handler
|
||||
);
|
||||
|
||||
Injector::inst()->unregisterNamedObject(HTTPRequest::class);
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user