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

Disable "null" as valid payload if expecting an object #29

Open
viktorasm opened this issue Jul 20, 2015 · 2 comments
Open

Disable "null" as valid payload if expecting an object #29

viktorasm opened this issue Jul 20, 2015 · 2 comments
Labels

Comments

@viktorasm
Copy link
Contributor

Would it make sense that since Napping's Get() method does not allow returning Nil for a payload object, the library returns error if such response from a service is received? Right now, if service response is "null", Napping silently accepts that it's a valid JSON document, and does not fill any of the contents in provided struct.

While highly situational, today I encountered this weird behavior when 3rd party service bugged out and instead of expected response structure returned HTTP 200 with a payload "null".

@jmcvetta
Copy link
Owner

Interesting question. I don't have a real strong opinion on what is the most correct/desirable behavior in that situation. So I'd be happy to hear the opinions of other users.

@gdm85
Copy link
Contributor

gdm85 commented Jul 29, 2015

I agree with @viktorasm

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

No branches or pull requests

3 participants