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

JsonResponse error on redirect #8

Closed
khoan opened this issue Aug 8, 2014 · 2 comments
Closed

JsonResponse error on redirect #8

khoan opened this issue Aug 8, 2014 · 2 comments

Comments

@khoan
Copy link
Contributor

khoan commented Aug 8, 2014

How would we ignore errors from RC::JsonResponse on Redirect?

e.g.

curl http://some.json.api/
=>
HTTP/1.1 301 Moved Permanently
Location: https://some.json.api/
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>301 Moved Permanently</TITLE></HEAD><BODY>
<H1>30 Moved</H1>
The document has moved
<A HREF="https://some.json.api/">here</A>.
</BODY></HTML>
RC::Universal.new('site' => 'http://some.json.api/', 'json_response' => true).get('/')
=> RestCore::JsonResponse::ParseError: 399: unexpected token at ...
@godfat
Copy link
Owner

godfat commented Aug 8, 2014

This is because RC::FollowRedirect is behind of RC::JsonResponse in RC::Universal. I think it makes sense to have it reversed so that it's much more general. (some sites might not return proper JSON upon redirect)

Please checkout 674f61d
This would be included in the next release.

Thanks for pointing this out!

@khoan
Copy link
Contributor Author

khoan commented Aug 8, 2014

ah sweet! thanks!

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

No branches or pull requests

2 participants