You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Move Request making to L345 and remove L355-L363 entirely
yii\filters\ContentNegotiator::bootstrap() should only register eventHandler on yii\base\Application on beforeAction event and handle it's own yii\filters\ContentNegotiator::beforeAction()
The text was updated successfully, but these errors were encountered:
We cannot remove L355-L363 since they are actually needed.
What we could theoretically do is intercept component creation:
Get the original component definition for the request component, can be an array or a closure.
Replace it with a closure that resolves the original definition and then initializes the request content like currently done in L355-363.
We have a hard time cleanly integrating because both the application as well as the request might be custom classes.
Also, in general using application bootstrap will lead to weird behavior since by default we don't recreate the application before each request. My personal opinion is that you should not interact with the request in the application bootstrap phase. But your argument that this should be possible (since ContentNegotiator does it) is also valid.
This means that if inside 1 test you do 2 requests the bootstrap code will only run once. And in the case of ContentNegotiator will probably set your application language based on the first request only.
IF I want to use
yii\filters\ContentNegotiator
in bootstrap(as it implementsyii\base\BootstrapInterface
and therefore I should be able to do so)It unfortunately does not work as
Therefore it does not work
There are 2 solutions how to fix it
yii\filters\ContentNegotiator::bootstrap()
should only register eventHandler onyii\base\Application
onbeforeAction
event and handle it's ownyii\filters\ContentNegotiator::beforeAction()
The text was updated successfully, but these errors were encountered: