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