Waboodoo / HTTP-Shortcuts

Android app to create home screen shortcuts that trigger arbitrary HTTP requests
https://http-shortcuts.rmy.ch
MIT License
1.17k stars 113 forks source link

[BUG] Execution failed when HTTP 302 is returned #249

Closed nenigi closed 2 years ago

nenigi commented 3 years ago

Steps To Reproduce

  1. Create a new shortcut
  2. On "Basic request settings", set as example http://httpstat.us/302
  3. On "Advanced Technical Settings", disable "Follow redirects"
  4. Run. An error "http://httpstat.us/302 failed with status code 302 (found)" will be displayed
  5. If scripting is required, it will only be executed if placed on "Run on failure" section

Expected behavior As the "Follow redirects" is disabled, and a 302 HTTP status code is obtained, the request shall be considered as successful (reference). 3xx status codes should not be considered as failures.

Actual behavior The request is considered as failed.

Screenshots https://i.ibb.co/QJLrTh3/Screenshot-20211129-125719-HTTP-Shortcuts.jpg

Context:

Waboodoo commented 3 years ago

Thanks for the bug report. It seems that the library I'm using to make the HTTP requests (OkHttp) does not consider a 3xx status code as a success. However, I agree with you that in this case it would make more sense to treat it as such, given that with the disabling of the "Follow redirects" checkbox the user opts in to seeing this response. I am including a fix for this in the upcoming 2.12.0 version release.