-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update to v2 #32
Comments
What are the BC breaks compared to 1.x? |
@tuupola new class for settings. Also strong typing everywhere which might require method signature updates. |
@tuupola For you, I think, it will only be needed to change private function buildSettings(ServerRequestInterface $request, ResponseInterface $response): AnalysisStrategyInterface
{
$cacheIsAvailable = ...;
if ($cacheIsAvailable === true) {
$cachedData = $this->getCorsCachedSettings();
return (new CorsSettings())->setData($cachedData);
}
$settings = (new CorsSettings())
->setServerOrigin('https', 'api.example.com', 443)
->setPreFlightCacheMaxAge(0)
->setCredentialsSupported()
->setAllowedOrigins(['https://www.example.com', ...]) // or enableAllOriginsAllowed()
->setAllowedMethods(['GET', 'POST', 'DELETE', ...]) // or enableAllMethodsAllowed()
->setAllowedHeaders(['X-Custom-Header', ...]) // or enableAllHeadersAllowed()
->setExposedHeaders(['X-Custom-Header', ...])
->disableAddAllowedMethodsToPreFlightResponse()
->disableAddAllowedHeadersToPreFlightResponse()
->enableCheckHost();
// cache settings
$dataToCache = $settings->getData();
...
return $settings;
} |
Quickly testing it also seems that calling |
The text was updated successfully, but these errors were encountered: