tests: refactor uris
This commit is contained in:
parent
16ce317c7e
commit
a4deffef77
@ -51,7 +51,7 @@ async fn test_get_error_500(ctx: &mut ProxyTestContext) {
|
|||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn test_upgrade_mismatch(ctx: &mut ProxyTestContext) {
|
async fn test_upgrade_mismatch(ctx: &mut ProxyTestContext) {
|
||||||
ctx.http_back.add(
|
ctx.http_back.add(
|
||||||
HandlerBuilder::new("/normal")
|
HandlerBuilder::new("/ws")
|
||||||
.status_code(StatusCode::SWITCHING_PROTOCOLS)
|
.status_code(StatusCode::SWITCHING_PROTOCOLS)
|
||||||
.build(),
|
.build(),
|
||||||
);
|
);
|
||||||
@ -61,7 +61,7 @@ async fn test_upgrade_mismatch(ctx: &mut ProxyTestContext) {
|
|||||||
.header(CONNECTION, "Upgrade")
|
.header(CONNECTION, "Upgrade")
|
||||||
.header(UPGRADE, "websocket")
|
.header(UPGRADE, "websocket")
|
||||||
.method("GET")
|
.method("GET")
|
||||||
.uri(ctx.uri("/normal"))
|
.uri(ctx.uri("/ws"))
|
||||||
.body(Body::from(""))
|
.body(Body::from(""))
|
||||||
.unwrap(),
|
.unwrap(),
|
||||||
)
|
)
|
||||||
@ -74,20 +74,11 @@ async fn test_upgrade_mismatch(ctx: &mut ProxyTestContext) {
|
|||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn test_upgrade_unrequested(ctx: &mut ProxyTestContext) {
|
async fn test_upgrade_unrequested(ctx: &mut ProxyTestContext) {
|
||||||
ctx.http_back.add(
|
ctx.http_back.add(
|
||||||
HandlerBuilder::new("/normal")
|
HandlerBuilder::new("/wrong_switch")
|
||||||
.status_code(StatusCode::SWITCHING_PROTOCOLS)
|
.status_code(StatusCode::SWITCHING_PROTOCOLS)
|
||||||
.build(),
|
.build(),
|
||||||
);
|
);
|
||||||
let resp = Client::new()
|
let resp = Client::new().get(ctx.uri("/wrong_switch")).await.unwrap();
|
||||||
.request(
|
|
||||||
Request::builder()
|
|
||||||
.method("GET")
|
|
||||||
.uri(ctx.uri("/normal"))
|
|
||||||
.body(Body::from(""))
|
|
||||||
.unwrap(),
|
|
||||||
)
|
|
||||||
.await
|
|
||||||
.unwrap();
|
|
||||||
assert_eq!(resp.status(), 502);
|
assert_eq!(resp.status(), 502);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user