mirror of
https://github.com/Orange-OpenSource/hurl.git
synced 2024-11-27 08:19:22 +03:00
Merge pull request #76 from Orange-OpenSource/fix/support-user-in-url
Support user in url
This commit is contained in:
commit
401c8a9a41
1
integration/tests/user_in_url.exit
Normal file
1
integration/tests/user_in_url.exit
Normal file
@ -0,0 +1 @@
|
||||
0
|
1
integration/tests/user_in_url.html
Normal file
1
integration/tests/user_in_url.html
Normal file
@ -0,0 +1 @@
|
||||
<div class="hurl-file"><div class="hurl-entry"><div class="request"><span class="line"><span class="method">GET</span> <span class="string">http://bob:secret@localhost:8000/basic-authentication</span></span></div><div class="response"><span class="line"><span class="version">HTTP/1.0</span> <span class="status">200</span></span></div></div></div>
|
5
integration/tests/user_in_url.hurl
Normal file
5
integration/tests/user_in_url.hurl
Normal file
@ -0,0 +1,5 @@
|
||||
GET http://bob:secret@localhost:8000/basic-authentication
|
||||
HTTP/1.0 200
|
||||
```You are authenticated```
|
||||
|
||||
|
1
integration/tests/user_in_url.json
Normal file
1
integration/tests/user_in_url.json
Normal file
@ -0,0 +1 @@
|
||||
{"entries":[{"request":{"method":"GET","url":"http://bob:secret@localhost:8000/basic-authentication"},"response":{"version":"HTTP/1.0","status":200}}]}
|
10
integration/tests/user_in_url.py
Normal file
10
integration/tests/user_in_url.py
Normal file
@ -0,0 +1,10 @@
|
||||
from tests import app
|
||||
from flask import request
|
||||
|
||||
@app.route('/user-in-url')
|
||||
def user_in_url():
|
||||
assert request.headers['Authorization'] == 'Basic Ym9iOnNlY3JldA=='
|
||||
return 'You are authenticated'
|
||||
|
||||
|
||||
|
@ -444,6 +444,23 @@ fn test_basic_authentication() {
|
||||
assert_eq!(response.status, 200);
|
||||
assert_eq!(response.version, Version::Http10);
|
||||
assert_eq!(response.body, b"You are authenticated".to_vec());
|
||||
|
||||
let mut client = default_client();
|
||||
let request = Request {
|
||||
method: Method::Get,
|
||||
url: "http://bob:secret@localhost:8000/basic-authentication".to_string(),
|
||||
headers: vec![],
|
||||
querystring: vec![],
|
||||
form: vec![],
|
||||
multipart: vec![],
|
||||
cookies: vec![],
|
||||
body: vec![],
|
||||
content_type: None,
|
||||
};
|
||||
let response = client.execute(&request, 0).unwrap();
|
||||
assert_eq!(response.status, 200);
|
||||
assert_eq!(response.version, Version::Http10);
|
||||
assert_eq!(response.body, b"You are authenticated".to_vec());
|
||||
}
|
||||
|
||||
// region error
|
||||
|
@ -195,7 +195,7 @@ fn url(reader: &mut Reader) -> ParseResult<'static, Template> {
|
||||
None => break,
|
||||
Some(c) => {
|
||||
if c.is_alphanumeric()
|
||||
|| vec![':', '/', '.', '-', '?', '=', '&', '_', '%', '*', ',']
|
||||
|| vec![':', '/', '.', '-', '?', '=', '&', '_', '%', '*', ',', '@']
|
||||
.contains(&c)
|
||||
{
|
||||
buffer.push(c);
|
||||
|
Loading…
Reference in New Issue
Block a user