mirror of
https://github.com/YGGverse/agate.git
synced 2026-04-08 12:35:28 +00:00
add tests for fragment and userinfo URLs
This commit is contained in:
parent
ba9297eabf
commit
869a784b59
1 changed files with 39 additions and 0 deletions
|
|
@ -244,6 +244,45 @@ fn full_header_preset() {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
/// - URLS with fragments are rejected
|
||||||
|
fn fragment() {
|
||||||
|
let page = get(
|
||||||
|
&["--addr", "[::]:1983", "--hostname", "example.com"],
|
||||||
|
addr(1983),
|
||||||
|
"gemini://example.com/#fragment",
|
||||||
|
)
|
||||||
|
.expect("could not get page");
|
||||||
|
|
||||||
|
assert_eq!(page.header.status, Status::BadRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
/// - URLS with username are rejected
|
||||||
|
fn username() {
|
||||||
|
let page = get(
|
||||||
|
&["--addr", "[::]:1984", "--hostname", "example.com"],
|
||||||
|
addr(1984),
|
||||||
|
"gemini://user@example.com/",
|
||||||
|
)
|
||||||
|
.expect("could not get page");
|
||||||
|
|
||||||
|
assert_eq!(page.header.status, Status::BadRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
/// - URLS with password are rejected
|
||||||
|
fn password() {
|
||||||
|
let page = get(
|
||||||
|
&["--addr", "[::]:1984", "--hostname", "example.com"],
|
||||||
|
addr(1984),
|
||||||
|
"gemini://:secret@example.com/",
|
||||||
|
)
|
||||||
|
.expect("could not get page");
|
||||||
|
|
||||||
|
assert_eq!(page.header.status, Status::BadRequest);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
/// - hostname is checked when provided
|
/// - hostname is checked when provided
|
||||||
/// - status for wrong host is "proxy request refused"
|
/// - status for wrong host is "proxy request refused"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue