-
Notifications
You must be signed in to change notification settings - Fork 113
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
Response headers are unavailable outside the WebApiContext #6
Comments
the second option is invalid. Request headers and response headers are 2 totally different stuff. They should not be mixed in the same property (it would break stuff when sending a second request). |
Then 1 or 3 ? I prefer 1 as it does not decide on behalf of the users, and keeps their options open. 2 could probably work too, but that would require awkward scenarios resetting the headers before adding new ones, so I agree it is not a good idea. |
2 cannot work, because it mean you loose the configured request headers when receiving a response. and we cannot reset the array before sendign a request, as this would defeat the whole point of adding this array in the first place. I don't like 1 because it means that the response property becomes an extension point of the context, for which we cannot do any change without BC break. This would restrict our possibilities too much for the future. Thus, each user of the response property would have to be careful when using it, because its type is I prefer doing a bigger refactoring to include things coming from the RestExtension. See #3. |
Hi! Could you at least make the response object available via getter... it's not possible to add additional assertions in our contexts as our hands are tight at the moment. i could send a pull request if you wish. best regards, thomas |
|
@pasxel i would not recommend that as then you cannot guarantee what someone will do with $response. Better having a getter for it. but that's just my opinion.. |
@dready Yes, I agree. The main thing to get response in the child class. |
+1 |
1 similar comment
+1 |
actually there is a pull request waiting for this... |
👍 I NEED TO GET TO THE RESPONSE |
For god's sake, let us get access to response. |
👍 Required since we would like to use our own, unescaped regexes, etc. |
ping @stof |
Yeah, we need to access the response somehow. |
I need access response +1 |
This is really silly. The best part of this extension is the setting up and constructing of the response object. But then we can't get to it! Copy-paste copy-paste copy-paste. We need the response object. 😾 |
This is important to us as well. Is this project still maintained? |
@jurgenhaas i would say not /cc @stof |
The best thing we can do now is to fork the project, modify it as we need and add these lines to
|
Is there a way to use this approach with I have tried |
Since $response has been set to private and $headers is currently only used for request headers, contexts inheriting WebApiContext have no way to access the response headers.
Suggested change:
$response
asprotected
instead ofprivate
$this->headers = $this->response->getHeaders();
at the end ofsendRequest()
, making headers usable for both request and responseThe text was updated successfully, but these errors were encountered: