Skip to content
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 decoders called if no Content-Type is present #8

Closed
lathspell opened this issue Sep 28, 2017 · 2 comments
Closed

Response decoders called if no Content-Type is present #8

lathspell opened this issue Sep 28, 2017 · 2 comments

Comments

@lathspell
Copy link

Problem:
I have one $rest object that I use for several calls. If the first get() is answered with Content-Type: application/json and the second get() is answered with just 204 No Content without any Content-Type header at all then it is still processed by the JSONDecoder class, which produces an syntax error.

Probably cause:
In Core.php the $this->response object is initialized only in the constructor and not in e.g. call().
So any headers that are not present in a HTTP response will keep their previous values.

Possible fix:
I tried to move the initialization to call() which solved this problem but created a new one. Now the JSONDecoder is not called at all as BaseDecoder compares against an empty "$this->content_type".
I gabe up there :)

@othercodes
Copy link
Owner

HI! sorry for my late response, have been busy, I have added some fixes and unit test over the project the new version should work properly now please try it.

Check pull-request #9

@othercodes
Copy link
Owner

I will close this, the issue seems to be solved :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants