mirror of
https://github.com/Orange-OpenSource/hurl.git
synced 2024-09-21 02:38:20 +03:00
Add Integ test for --location-trusted option
This commit is contained in:
parent
bb539ddad7
commit
8f7cc2270f
@ -48,3 +48,14 @@ def follow_redirect_basic_auth():
|
||||
def followed_redirect_basic_auth():
|
||||
assert "Authorization" not in request.headers
|
||||
return "Followed redirect Basic Auth!"
|
||||
|
||||
|
||||
@app.route("/follow-redirect-basic-auth-trusted")
|
||||
def follow_redirect_basic_auth_trusted():
|
||||
return redirect("http://127.0.0.1:8000/followed-redirect-basic-auth-trusted")
|
||||
|
||||
|
||||
@app.route("/followed-redirect-basic-auth-trusted")
|
||||
def followed_redirect_basic_auth_trusted():
|
||||
assert request.headers["Authorization"] == "Basic Ym9iQGVtYWlsLmNvbTpzZWNyZXQ="
|
||||
return "Followed redirect Basic Auth!"
|
||||
|
@ -3,3 +3,5 @@ curl --header 'Accept: text/plain' 'http://localhost:8000/follow-redirect'
|
||||
curl --header 'Accept: text/plain' --location 'http://localhost:8000/follow-redirect'
|
||||
curl --data '' --header 'Accept: text/plain' --location 'http://localhost:8000/follow-redirect'
|
||||
curl --data '' --header 'Accept: text/plain' --location 'http://localhost:8000/follow-redirect-308'
|
||||
curl --location --header 'Authorization: Basic Ym9iQGVtYWlsLmNvbTpzZWNyZXQ=' 'http://localhost:8000/follow-redirect-basic-auth'
|
||||
curl --location-trusted --header 'Authorization: Basic Ym9iQGVtYWlsLmNvbTpzZWNyZXQ=' 'http://localhost:8000/follow-redirect-basic-auth-trusted'
|
@ -45,7 +45,7 @@ HTTP 200
|
||||
header "Location" not exists
|
||||
`Followed redirect POST!`
|
||||
|
||||
# Do not forward authorization header by default toa different host
|
||||
# Do not forward authorization header by default to a different host
|
||||
GET http://localhost:8000/follow-redirect-basic-auth
|
||||
Authorization: Basic Ym9iQGVtYWlsLmNvbTpzZWNyZXQ=
|
||||
[Options]
|
||||
@ -54,3 +54,13 @@ HTTP 200
|
||||
[Asserts]
|
||||
header "Location" not exists
|
||||
`Followed redirect Basic Auth!`
|
||||
|
||||
# Forward authorization header to a different host explicitly
|
||||
GET http://localhost:8000/follow-redirect-basic-auth-trusted
|
||||
Authorization: Basic Ym9iQGVtYWlsLmNvbTpzZWNyZXQ=
|
||||
[Options]
|
||||
location-trusted: true
|
||||
HTTP 200
|
||||
[Asserts]
|
||||
header "Location" not exists
|
||||
`Followed redirect Basic Auth!`
|
||||
|
@ -36,6 +36,9 @@ Options:
|
||||
Set root filesystem to import files [default: current directory]
|
||||
-L, --location
|
||||
Follow redirects
|
||||
--location-trusted
|
||||
Follow redirects but allows sending the name + password to all hosts that the site may
|
||||
redirect to.
|
||||
--glob <GLOB>
|
||||
Specify input files that match the given GLOB. Multiple glob flags may be used
|
||||
-0, --http1.0
|
||||
@ -97,8 +100,8 @@ Options:
|
||||
Activate test mode
|
||||
--to-entry <ENTRY_NUMBER>
|
||||
Execute Hurl file to ENTRY_NUMBER (starting at 1)
|
||||
--unix-socket <PATH>
|
||||
(HTTP) Connect through this Unix domain socket, instead of using the network.
|
||||
--unix-socket <path>
|
||||
(HTTP) Connect through this Unix domain socket, instead of using the network
|
||||
-A, --user-agent <NAME>
|
||||
Specify the User-Agent string to send to the HTTP server
|
||||
-u, --user <USER:PASSWORD>
|
||||
|
@ -8,6 +8,7 @@
|
||||
<span class="line"><span class="string">connect-to</span>: <span class="string">example.com:443:example.net:8443</span></span>
|
||||
<span class="line"><span class="string">delay</span>: <span class="number">1000</span></span>
|
||||
<span class="line"><span class="string">location</span>: <span class="boolean">false</span></span>
|
||||
<span class="line"><span class="string">location-trusted</span>: <span class="boolean">false</span></span>
|
||||
<span class="line"><span class="string">http1.0</span>: <span class="boolean">false</span></span>
|
||||
<span class="line"><span class="string">http1.1</span>: <span class="boolean">false</span></span>
|
||||
<span class="line"><span class="string">http2</span>: <span class="boolean">false</span></span>
|
||||
|
@ -8,6 +8,7 @@ compressed: false
|
||||
connect-to: example.com:443:example.net:8443
|
||||
delay: 1000
|
||||
location: false
|
||||
location-trusted: false
|
||||
http1.0: false
|
||||
http1.1: false
|
||||
http2: false
|
||||
|
@ -1 +1 @@
|
||||
{"entries":[{"request":{"method":"GET","url":"http://localhost:8000/hello","options":[{"name":"aws-sigv4","value":"aws:amz:eu-central-1:sts"},{"name":"cacert","value":"cacertfile"},{"name":"cert","value":"certfile"},{"name":"key","value":"keyfile"},{"name":"compressed","value":false},{"name":"connect-to","value":"example.com:443:example.net:8443"},{"name":"delay","value":1000},{"name":"location","value":false},{"name":"http1.0","value":false},{"name":"http1.1","value":false},{"name":"http2","value":false},{"name":"http3","value":false},{"name":"insecure","value":false},{"name":"ipv4","value":false},{"name":"ipv6","value":false},{"name":"max-redirs","value":10},{"name":"output","value":"output.txt"},{"name":"path-as-is","value":false},{"name":"proxy","value":"http://proxy.example"},{"name":"resolve","value":"example.com:443:127.0.0.1"},{"name":"retry","value":0},{"name":"retry","value":-1},{"name":"retry","value":4},{"name":"retry-interval","value":1000},{"name":"skip","value":false},{"name":"variable","value":"user=null"},{"name":"variable","value":"status=true"},{"name":"variable","value":"count=2"},{"name":"variable","value":"score=7.7"},{"name":"variable","value":"name=Bob"},{"name":"verbose","value":false},{"name":"very-verbose","value":false}]}},{"request":{"method":"GET","url":"http://localhost:8000/hello","options":[{"name":"aws-sigv4","value":"{{aws-sigv4}}"},{"name":"compressed","value":"{{compressed}}"},{"name":"connect-to","value":"{{connect-to}}"},{"name":"delay","value":"{{delay}}"},{"name":"location","value":"{{location}}"},{"name":"http1.0","value":"{{http10}}"},{"name":"http1.1","value":"{{http11}}"},{"name":"http2","value":"{{http2}}"},{"name":"http3","value":"{{http3}}"},{"name":"insecure","value":"{{insecure}}"},{"name":"ipv4","value":"{{ipv4}}"},{"name":"ipv6","value":"{{ipv6}}"},{"name":"max-redirs","value":"{{max-redirs}}"},{"name":"path-as-is","value":"{{path-as-is}}"},{"name":"proxy","value":"{{proxy}}"},{"name":"resolve","value":"{{resolve}}"},{"name":"retry","value":"{{retry}}"},{"name":"retry-interval","value":"{{retry-interval}}"},{"name":"skip","value":"{{skip}}"},{"name":"verbose","value":"{{verbose}}"},{"name":"very-verbose","value":"{{very-verbose}}"}]}}]}
|
||||
{"entries":[{"request":{"method":"GET","url":"http://localhost:8000/hello","options":[{"name":"aws-sigv4","value":"aws:amz:eu-central-1:sts"},{"name":"cacert","value":"cacertfile"},{"name":"cert","value":"certfile"},{"name":"key","value":"keyfile"},{"name":"compressed","value":false},{"name":"connect-to","value":"example.com:443:example.net:8443"},{"name":"delay","value":1000},{"name":"location","value":false},{"name":"location-trusted","value":false},{"name":"http1.0","value":false},{"name":"http1.1","value":false},{"name":"http2","value":false},{"name":"http3","value":false},{"name":"insecure","value":false},{"name":"ipv4","value":false},{"name":"ipv6","value":false},{"name":"max-redirs","value":10},{"name":"output","value":"output.txt"},{"name":"path-as-is","value":false},{"name":"proxy","value":"http://proxy.example"},{"name":"resolve","value":"example.com:443:127.0.0.1"},{"name":"retry","value":0},{"name":"retry","value":-1},{"name":"retry","value":4},{"name":"retry-interval","value":1000},{"name":"skip","value":false},{"name":"variable","value":"user=null"},{"name":"variable","value":"status=true"},{"name":"variable","value":"count=2"},{"name":"variable","value":"score=7.7"},{"name":"variable","value":"name=Bob"},{"name":"verbose","value":false},{"name":"very-verbose","value":false}]}},{"request":{"method":"GET","url":"http://localhost:8000/hello","options":[{"name":"aws-sigv4","value":"{{aws-sigv4}}"},{"name":"compressed","value":"{{compressed}}"},{"name":"connect-to","value":"{{connect-to}}"},{"name":"delay","value":"{{delay}}"},{"name":"location","value":"{{location}}"},{"name":"http1.0","value":"{{http10}}"},{"name":"http1.1","value":"{{http11}}"},{"name":"http2","value":"{{http2}}"},{"name":"http3","value":"{{http3}}"},{"name":"insecure","value":"{{insecure}}"},{"name":"ipv4","value":"{{ipv4}}"},{"name":"ipv6","value":"{{ipv6}}"},{"name":"max-redirs","value":"{{max-redirs}}"},{"name":"path-as-is","value":"{{path-as-is}}"},{"name":"proxy","value":"{{proxy}}"},{"name":"resolve","value":"{{resolve}}"},{"name":"retry","value":"{{retry}}"},{"name":"retry-interval","value":"{{retry-interval}}"},{"name":"skip","value":"{{skip}}"},{"name":"verbose","value":"{{verbose}}"},{"name":"very-verbose","value":"{{very-verbose}}"}]}}]}
|
||||
|
Loading…
Reference in New Issue
Block a user