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

Typhoeus has a return code of OK when successful #736

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

spizm
Copy link

@spizm spizm commented Dec 29, 2017

Whenever Typhoeus successfully completes a request, the return code is :ok. This pull request adds this return code to the adapter.

@spizm spizm changed the title Typhoeus returns OK for a return code Typhoeus has a return code of OK when successful Dec 29, 2017
@bblimke
Copy link
Owner

bblimke commented Jan 3, 2018

@spizm thank you, but I believe this pull request is not complete.

According to Typhoeus code, :ok is only returned for 200-299 responses: https://github.com/typhoeus/typhoeus/blob/d03fceba09d0296b94ed009fb1b5c0cfc95e7418/spec/typhoeus/response/status_spec.rb#L78

If we are to add support for return_code, then I guess we should handle all other cases as well.

@nrw505
Copy link

nrw505 commented Mar 22, 2024

Typhoeus sets return_code: :ok for HTTP statuses other than 200-299

e.g.

irb(main):001> require 'typhoeus'
=> true
irb(main):002> response = Typhoeus.get("http://localhost:5005/500")
=> 
#<Typhoeus::Response:0x00007f862c8e7b78
...
irb(main):003> response.return_code
=> :ok
irb(main):004> response.code
=> 500
irb(main):005> 

@bblimke
Copy link
Owner

bblimke commented Apr 1, 2024

@nrw505 thank you for reporting. Do you know what are the other return_code's and for what status codes should these be returned?

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

Successfully merging this pull request may close these issues.

None yet

3 participants