cranetm / yii2-json-rpc-2.0

Other
26 stars 18 forks source link

Maintain headers set in Yii's Response object #3

Closed tyler-ham closed 7 years ago

tyler-ham commented 9 years ago

I ran into a little trouble trying to enable the Cors filter. It sets headers in the Yii:$app->getResponse() object, but the runAction() method would return an entirely new Response object, so the response headers would be lost.

With this commit, we just set the format and data properties of the existing Response object and return it.

I think this is a relatively simple fix, but if there was a reason a new Response object was being created, then we should discuss it before merging this in, since there might be a better solution (like copying over headers from the existing Response object).

cranetm commented 9 years ago

can not remember about this Response object. it has to be tested.

cranetm commented 7 years ago

Found with issue while making CORS Support, see commit 1fd3f25407bc1749d58cc0e50d9c4b39ead30a46. Thank you.