drill
drill copied to clipboard
Expected HTTP status codes / redirects
While giving drill a try, I noticed that it follows redirects and reports the resulting final page. I had been planning to have a sequence where it would do something like /, /login, etc. and was hoping to have a way to either say “Don't follow redirects on this URL” or “Expect this page to return a 403” so I can exercise the unauthenticated endpoints as well as their targets.
The current behaviour for redirects, right now, is the default from reqwest, that follows 10 redirects. You can find more information here:
https://docs.rs/reqwest/0.10.4/reqwest/redirect/struct.Policy.html
If you think this could be a useful feature to be added to drill to let the user set the number of redirects, let me know.
The main thing I was thinking was having two options to say it's not an error to get a non-200 for a particular response and to disable redirects so you could do something like this:
plan:
- name: user_page_without_session
request:
url: /private/content/
follow_redirects: false
expected_status: 302
The reqwest docs make me wonder whether that could simply be something like this (it's not immediately clear to me whether there's any difference between limited(0) and none()):
plan:
- name: user_page_without_session
request:
url: /private/content/
redirect_policy:
limited: 0
expected_status: 302
It could be really interesting to add this follow_redirects option you mentioned :ok_hand: About expected_status, I'm not sure to understand what is going to do.
I would really like the feature of not following redirects :) It's very common for a web app (implemented in the old style of generating HTML templates on the server) to use the Post/Redirect/Get pattern. So almost all POST endpoints return redirects haha.