Orange-OpenSource / hurl

Hurl, run and test HTTP requests with plain text.
https://hurl.dev
Apache License 2.0
13.07k stars 489 forks source link

How to know if there has been a redirection or not ? #922

Open ecolinet opened 2 years ago

ecolinet commented 2 years ago

Hi, When I use :

[Options]
location: true

I want to know if a redirection has occured or not.

Is it possible to have a redirection counter ?

In my case url is not enought because the redirection bring me back the the original url and asserting for a 200 status code doesn't say if there has been a redirection or not.

Thanks

fabricereix commented 2 years ago

Thanks for your suggestion. we could add a query redirections to get all the redirections that had occured, and then use our count filter.

Something like that.

[Asserts]
redirections count > 0
ecolinet commented 2 years ago

Sounds good thanks

Le lun. 24 oct. 2022 à 12:02, Fabrice Reix @.***> a écrit :

Thanks for your suggestion. we could add a query redirections to get all the redirections that had occured, and then use our count filter.

Something like that.

[Asserts] redirections count > 0

— Reply to this email directly, view it on GitHub https://github.com/Orange-OpenSource/hurl/issues/922#issuecomment-1288769261, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAP7YTP6KOCKFDA2DV2RTLWEZNFFANCNFSM6AAAAAARMZEAT4 . You are receiving this because you authored the thread.Message ID: @.***>

jcamiel commented 2 years ago

As we speak of "HTTP redirects", I will prefer redirects as noun of the query:

[Asserts]
redirects count > 0

Extract from https://developer.mozilla.org/en-US/docs/Web/HTTP/Redirections

HTTP has a special kind of response, called a HTTP redirect, for this operation.