fix: Update to latest master Rocket version (#85)
- Add explicit branch name to rocket dependency - Fix linter errors
This commit is contained in:
parent
fae7ccf9ce
commit
8427e62521
|
@ -22,7 +22,7 @@ serialization = ["serde", "serde_derive", "unicase_serde"]
|
|||
|
||||
[dependencies]
|
||||
regex = "1.1"
|
||||
rocket = { git="https://github.com/SergioBenitez/Rocket.git", default-features = false }
|
||||
rocket = { branch = "master", git = "https://github.com/SergioBenitez/Rocket.git", default-features = false }
|
||||
log = "0.4"
|
||||
unicase = "2.0"
|
||||
url = "2.1.0"
|
||||
|
|
|
@ -32,7 +32,7 @@ impl rocket::handler::Handler for FairingErrorRoute {
|
|||
error_!("Fairing Error Handling Route error: {:?}", e);
|
||||
500
|
||||
});
|
||||
let status = Status::from_code(status).unwrap_or_else(|| Status::InternalServerError);
|
||||
let status = Status::from_code(status).unwrap_or(Status::InternalServerError);
|
||||
Outcome::Failure(status)
|
||||
}
|
||||
}
|
||||
|
@ -115,7 +115,7 @@ impl rocket::fairing::Fairing for Cors {
|
|||
))
|
||||
}
|
||||
|
||||
async fn on_request(&self, request: &mut Request<'_>, _: &rocket::Data) {
|
||||
async fn on_request(&self, request: &mut Request<'_>, _: &mut rocket::Data) {
|
||||
let result = match validate(self, request) {
|
||||
Ok(_) => CorsValidation::Success,
|
||||
Err(err) => {
|
||||
|
@ -171,7 +171,7 @@ mod tests {
|
|||
#[test]
|
||||
#[allow(non_snake_case)]
|
||||
fn FairingErrorRoute_returns_passed_in_status() {
|
||||
let client = Client::new(rocket(make_cors_options())).expect("to not fail");
|
||||
let client = Client::tracked(rocket(make_cors_options())).expect("to not fail");
|
||||
let request = client.get(format!("{}/403", CORS_ROOT));
|
||||
let response = request.dispatch();
|
||||
assert_eq!(Status::Forbidden, response.status());
|
||||
|
@ -180,7 +180,7 @@ mod tests {
|
|||
#[test]
|
||||
#[allow(non_snake_case)]
|
||||
fn FairingErrorRoute_returns_500_for_unknown_status() {
|
||||
let client = Client::new(rocket(make_cors_options())).expect("to not fail");
|
||||
let client = Client::tracked(rocket(make_cors_options())).expect("to not fail");
|
||||
let request = client.get(format!("{}/999", CORS_ROOT));
|
||||
let response = request.dispatch();
|
||||
assert_eq!(Status::InternalServerError, response.status());
|
||||
|
@ -188,12 +188,10 @@ mod tests {
|
|||
|
||||
#[rocket::async_test]
|
||||
async fn error_route_is_mounted_on_attach() {
|
||||
let mut rocket = rocket(make_cors_options());
|
||||
let rocket = rocket(make_cors_options());
|
||||
|
||||
let expected_uri = format!("{}/<status>", CORS_ROOT);
|
||||
let error_route = rocket
|
||||
.inspect()
|
||||
.await
|
||||
.routes()
|
||||
.find(|r| r.method == Method::Get && r.uri.to_string() == expected_uri);
|
||||
assert!(error_route.is_some());
|
||||
|
|
|
@ -267,7 +267,7 @@ mod tests {
|
|||
/// Make a client with no routes for unit testing
|
||||
fn make_client() -> Client {
|
||||
let rocket = rocket::ignite();
|
||||
Client::new(rocket).expect("valid rocket instance")
|
||||
Client::tracked(rocket).expect("valid rocket instance")
|
||||
}
|
||||
|
||||
// `Origin::from_str` tests
|
||||
|
|
|
@ -1816,7 +1816,7 @@ fn preflight_validate(
|
|||
// do not set any additional headers and terminate this set of steps.
|
||||
// The request is outside the scope of this specification.
|
||||
|
||||
let method = method.as_ref().ok_or_else(|| Error::MissingRequestMethod)?;
|
||||
let method = method.as_ref().ok_or(Error::MissingRequestMethod)?;
|
||||
|
||||
// 4. Let header field-names be the values as result of parsing the
|
||||
// Access-Control-Request-Headers headers.
|
||||
|
@ -2081,7 +2081,7 @@ mod tests {
|
|||
/// Make a client with no routes for unit testing
|
||||
fn make_client() -> Client {
|
||||
let rocket = rocket::ignite();
|
||||
Client::new(rocket).expect("valid rocket instance")
|
||||
Client::tracked(rocket).expect("valid rocket instance")
|
||||
}
|
||||
|
||||
// CORS options test
|
||||
|
|
|
@ -44,7 +44,7 @@ fn rocket() -> rocket::Rocket {
|
|||
|
||||
#[test]
|
||||
fn smoke_test() {
|
||||
let client = Client::new(rocket()).unwrap();
|
||||
let client = Client::tracked(rocket()).unwrap();
|
||||
|
||||
// `Options` pre-flight checks
|
||||
let origin_header = Header::new(ORIGIN.as_str(), "https://www.acme.com");
|
||||
|
@ -80,7 +80,7 @@ fn smoke_test() {
|
|||
|
||||
#[test]
|
||||
fn cors_options_check() {
|
||||
let client = Client::new(rocket()).unwrap();
|
||||
let client = Client::tracked(rocket()).unwrap();
|
||||
|
||||
let origin_header = Header::new(ORIGIN.as_str(), "https://www.acme.com");
|
||||
let method_header = Header::new(
|
||||
|
@ -106,7 +106,7 @@ fn cors_options_check() {
|
|||
|
||||
#[test]
|
||||
fn cors_get_check() {
|
||||
let client = Client::new(rocket()).unwrap();
|
||||
let client = Client::tracked(rocket()).unwrap();
|
||||
|
||||
let origin_header = Header::new(ORIGIN.as_str(), "https://www.acme.com");
|
||||
let authorization = Header::new("Authorization", "let me in");
|
||||
|
@ -126,7 +126,7 @@ fn cors_get_check() {
|
|||
/// This test is to check that non CORS compliant requests to GET should still work. (i.e. curl)
|
||||
#[test]
|
||||
fn cors_get_no_origin() {
|
||||
let client = Client::new(rocket()).unwrap();
|
||||
let client = Client::tracked(rocket()).unwrap();
|
||||
|
||||
let authorization = Header::new("Authorization", "let me in");
|
||||
let req = client.get("/").header(authorization);
|
||||
|
@ -139,7 +139,7 @@ fn cors_get_no_origin() {
|
|||
|
||||
#[test]
|
||||
fn cors_options_bad_origin() {
|
||||
let client = Client::new(rocket()).unwrap();
|
||||
let client = Client::tracked(rocket()).unwrap();
|
||||
|
||||
let origin_header = Header::new(ORIGIN.as_str(), "https://www.bad-origin.com");
|
||||
let method_header = Header::new(
|
||||
|
@ -160,7 +160,7 @@ fn cors_options_bad_origin() {
|
|||
/// Unlike the "ad-hoc" mode, this should return 404 because we don't have such a route
|
||||
#[test]
|
||||
fn cors_options_missing_origin() {
|
||||
let client = Client::new(rocket()).unwrap();
|
||||
let client = Client::tracked(rocket()).unwrap();
|
||||
|
||||
let method_header = Header::new(
|
||||
ACCESS_CONTROL_REQUEST_METHOD.as_str(),
|
||||
|
@ -183,7 +183,7 @@ fn cors_options_missing_origin() {
|
|||
|
||||
#[test]
|
||||
fn cors_options_bad_request_method() {
|
||||
let client = Client::new(rocket()).unwrap();
|
||||
let client = Client::tracked(rocket()).unwrap();
|
||||
|
||||
let origin_header = Header::new(ORIGIN.as_str(), "https://www.acme.com");
|
||||
let method_header = Header::new(
|
||||
|
@ -207,7 +207,7 @@ fn cors_options_bad_request_method() {
|
|||
|
||||
#[test]
|
||||
fn cors_options_bad_request_header() {
|
||||
let client = Client::new(rocket()).unwrap();
|
||||
let client = Client::tracked(rocket()).unwrap();
|
||||
|
||||
let origin_header = Header::new(ORIGIN.as_str(), "https://www.acme.com");
|
||||
let method_header = Header::new(
|
||||
|
@ -231,7 +231,7 @@ fn cors_options_bad_request_header() {
|
|||
|
||||
#[test]
|
||||
fn cors_get_bad_origin() {
|
||||
let client = Client::new(rocket()).unwrap();
|
||||
let client = Client::tracked(rocket()).unwrap();
|
||||
|
||||
let origin_header = Header::new(ORIGIN.as_str(), "https://www.bad-origin.com");
|
||||
let authorization = Header::new("Authorization", "let me in");
|
||||
|
@ -250,7 +250,7 @@ fn cors_get_bad_origin() {
|
|||
/// The route used will panic if executed
|
||||
#[test]
|
||||
fn routes_failing_checks_are_not_executed() {
|
||||
let client = Client::new(rocket()).unwrap();
|
||||
let client = Client::tracked(rocket()).unwrap();
|
||||
|
||||
let origin_header = Header::new(ORIGIN.as_str(), "https://www.bad-origin.com");
|
||||
let method_header = Header::new(
|
||||
|
|
|
@ -15,7 +15,7 @@ static ACCESS_CONTROL_REQUEST_HEADERS: hyper::HeaderName =
|
|||
hyper::header::ACCESS_CONTROL_REQUEST_HEADERS;
|
||||
|
||||
#[get("/")]
|
||||
fn cors(cors: cors::Guard<'_>) -> cors::Responder<'_, '_, &str> {
|
||||
fn cors_responder(cors: cors::Guard<'_>) -> cors::Responder<'_, '_, &str> {
|
||||
cors.responder("Hello CORS")
|
||||
}
|
||||
|
||||
|
@ -80,7 +80,7 @@ fn make_cors() -> cors::Cors {
|
|||
|
||||
fn make_rocket() -> rocket::Rocket {
|
||||
rocket::ignite()
|
||||
.mount("/", routes![cors, panicking_route])
|
||||
.mount("/", routes![cors_responder, panicking_route])
|
||||
.mount(
|
||||
"/",
|
||||
routes![response, responder_string, responder_unit, state],
|
||||
|
@ -94,7 +94,7 @@ fn make_rocket() -> rocket::Rocket {
|
|||
#[test]
|
||||
fn smoke_test() {
|
||||
let rocket = make_rocket();
|
||||
let client = Client::new(rocket).unwrap();
|
||||
let client = Client::tracked(rocket).unwrap();
|
||||
|
||||
// `Options` pre-flight checks
|
||||
let origin_header = Header::new(ORIGIN.as_str(), "https://www.acme.com");
|
||||
|
@ -132,7 +132,7 @@ fn smoke_test() {
|
|||
#[test]
|
||||
fn cors_options_catch_all_check() {
|
||||
let rocket = make_rocket();
|
||||
let client = Client::new(rocket).unwrap();
|
||||
let client = Client::tracked(rocket).unwrap();
|
||||
|
||||
let origin_header = Header::new(ORIGIN.as_str(), "https://www.acme.com");
|
||||
let method_header = Header::new(
|
||||
|
@ -160,7 +160,7 @@ fn cors_options_catch_all_check() {
|
|||
#[test]
|
||||
fn cors_options_catch_all_check_other_routes() {
|
||||
let rocket = make_rocket();
|
||||
let client = Client::new(rocket).unwrap();
|
||||
let client = Client::tracked(rocket).unwrap();
|
||||
|
||||
let origin_header = Header::new(ORIGIN.as_str(), "https://www.acme.com");
|
||||
let method_header = Header::new(
|
||||
|
@ -187,7 +187,7 @@ fn cors_options_catch_all_check_other_routes() {
|
|||
#[test]
|
||||
fn cors_get_check() {
|
||||
let rocket = make_rocket();
|
||||
let client = Client::new(rocket).unwrap();
|
||||
let client = Client::tracked(rocket).unwrap();
|
||||
|
||||
let origin_header = Header::new(ORIGIN.as_str(), "https://www.acme.com");
|
||||
let authorization = Header::new("Authorization", "let me in");
|
||||
|
@ -208,7 +208,7 @@ fn cors_get_check() {
|
|||
#[test]
|
||||
fn cors_get_no_origin() {
|
||||
let rocket = make_rocket();
|
||||
let client = Client::new(rocket).unwrap();
|
||||
let client = Client::tracked(rocket).unwrap();
|
||||
|
||||
let authorization = Header::new("Authorization", "let me in");
|
||||
let req = client.get("/").header(authorization);
|
||||
|
@ -226,7 +226,7 @@ fn cors_get_no_origin() {
|
|||
#[test]
|
||||
fn cors_options_bad_origin() {
|
||||
let rocket = make_rocket();
|
||||
let client = Client::new(rocket).unwrap();
|
||||
let client = Client::tracked(rocket).unwrap();
|
||||
|
||||
let origin_header = Header::new(ORIGIN.as_str(), "https://www.bad-origin.com");
|
||||
let method_header = Header::new(
|
||||
|
@ -251,7 +251,7 @@ fn cors_options_bad_origin() {
|
|||
#[test]
|
||||
fn cors_options_missing_origin() {
|
||||
let rocket = make_rocket();
|
||||
let client = Client::new(rocket).unwrap();
|
||||
let client = Client::tracked(rocket).unwrap();
|
||||
|
||||
let method_header = Header::new(
|
||||
ACCESS_CONTROL_REQUEST_METHOD.as_str(),
|
||||
|
@ -274,7 +274,7 @@ fn cors_options_missing_origin() {
|
|||
#[test]
|
||||
fn cors_options_bad_request_method() {
|
||||
let rocket = make_rocket();
|
||||
let client = Client::new(rocket).unwrap();
|
||||
let client = Client::tracked(rocket).unwrap();
|
||||
|
||||
let origin_header = Header::new(ORIGIN.as_str(), "https://www.acme.com");
|
||||
let method_header = Header::new(
|
||||
|
@ -299,7 +299,7 @@ fn cors_options_bad_request_method() {
|
|||
#[test]
|
||||
fn cors_options_bad_request_header() {
|
||||
let rocket = make_rocket();
|
||||
let client = Client::new(rocket).unwrap();
|
||||
let client = Client::tracked(rocket).unwrap();
|
||||
|
||||
let origin_header = Header::new(ORIGIN.as_str(), "https://www.acme.com");
|
||||
let method_header = Header::new(
|
||||
|
@ -324,7 +324,7 @@ fn cors_options_bad_request_header() {
|
|||
#[test]
|
||||
fn cors_get_bad_origin() {
|
||||
let rocket = make_rocket();
|
||||
let client = Client::new(rocket).unwrap();
|
||||
let client = Client::tracked(rocket).unwrap();
|
||||
|
||||
let origin_header = Header::new(ORIGIN.as_str(), "https://www.bad-origin.com");
|
||||
let authorization = Header::new("Authorization", "let me in");
|
||||
|
@ -344,7 +344,7 @@ fn cors_get_bad_origin() {
|
|||
#[test]
|
||||
fn routes_failing_checks_are_not_executed() {
|
||||
let rocket = make_rocket();
|
||||
let client = Client::new(rocket).unwrap();
|
||||
let client = Client::tracked(rocket).unwrap();
|
||||
|
||||
let origin_header = Header::new(ORIGIN.as_str(), "https://www.bad-origin.com");
|
||||
let authorization = Header::new("Authorization", "let me in");
|
||||
|
@ -363,7 +363,7 @@ fn routes_failing_checks_are_not_executed() {
|
|||
#[test]
|
||||
fn overridden_options_routes_are_used() {
|
||||
let rocket = make_rocket();
|
||||
let client = Client::new(rocket).unwrap();
|
||||
let client = Client::tracked(rocket).unwrap();
|
||||
|
||||
let origin_header = Header::new(ORIGIN.as_str(), "https://www.acme.com");
|
||||
let method_header = Header::new(
|
||||
|
|
|
@ -33,7 +33,7 @@ fn request_headers(
|
|||
#[test]
|
||||
fn request_headers_round_trip_smoke_test() {
|
||||
let rocket = rocket::ignite().mount("/", routes![request_headers]);
|
||||
let client = Client::new(rocket).expect("A valid Rocket client");
|
||||
let client = Client::tracked(rocket).expect("A valid Rocket client");
|
||||
|
||||
let origin_header = Header::new(ORIGIN.as_str(), "https://foo.bar.xyz");
|
||||
let method_header = Header::new(
|
||||
|
|
|
@ -105,7 +105,7 @@ fn rocket() -> rocket::Rocket {
|
|||
|
||||
#[test]
|
||||
fn smoke_test() {
|
||||
let client = Client::new(rocket()).unwrap();
|
||||
let client = Client::tracked(rocket()).unwrap();
|
||||
|
||||
// `Options` pre-flight checks
|
||||
let origin_header = Header::new(ORIGIN.as_str(), "https://www.acme.com");
|
||||
|
@ -141,7 +141,7 @@ fn smoke_test() {
|
|||
|
||||
#[test]
|
||||
fn cors_options_borrowed_check() {
|
||||
let client = Client::new(rocket()).unwrap();
|
||||
let client = Client::tracked(rocket()).unwrap();
|
||||
|
||||
let origin_header = Header::new(ORIGIN.as_str(), "https://www.acme.com");
|
||||
let method_header = Header::new(
|
||||
|
@ -167,7 +167,7 @@ fn cors_options_borrowed_check() {
|
|||
|
||||
#[test]
|
||||
fn cors_get_borrowed_check() {
|
||||
let client = Client::new(rocket()).unwrap();
|
||||
let client = Client::tracked(rocket()).unwrap();
|
||||
|
||||
let origin_header = Header::new(ORIGIN.as_str(), "https://www.acme.com");
|
||||
let authorization = Header::new("Authorization", "let me in");
|
||||
|
@ -187,7 +187,7 @@ fn cors_get_borrowed_check() {
|
|||
/// This test is to check that non CORS compliant requests to GET should still work. (i.e. curl)
|
||||
#[test]
|
||||
fn cors_get_no_origin() {
|
||||
let client = Client::new(rocket()).unwrap();
|
||||
let client = Client::tracked(rocket()).unwrap();
|
||||
|
||||
let authorization = Header::new("Authorization", "let me in");
|
||||
let req = client.get("/").header(authorization);
|
||||
|
@ -200,7 +200,7 @@ fn cors_get_no_origin() {
|
|||
|
||||
#[test]
|
||||
fn cors_options_bad_origin() {
|
||||
let client = Client::new(rocket()).unwrap();
|
||||
let client = Client::tracked(rocket()).unwrap();
|
||||
|
||||
let origin_header = Header::new(ORIGIN.as_str(), "https://www.bad-origin.com");
|
||||
let method_header = Header::new(
|
||||
|
@ -220,7 +220,7 @@ fn cors_options_bad_origin() {
|
|||
|
||||
#[test]
|
||||
fn cors_options_missing_origin() {
|
||||
let client = Client::new(rocket()).unwrap();
|
||||
let client = Client::tracked(rocket()).unwrap();
|
||||
|
||||
let method_header = Header::new(
|
||||
ACCESS_CONTROL_REQUEST_METHOD.as_str(),
|
||||
|
@ -242,7 +242,7 @@ fn cors_options_missing_origin() {
|
|||
|
||||
#[test]
|
||||
fn cors_options_bad_request_method() {
|
||||
let client = Client::new(rocket()).unwrap();
|
||||
let client = Client::tracked(rocket()).unwrap();
|
||||
|
||||
let origin_header = Header::new(ORIGIN.as_str(), "https://www.acme.com");
|
||||
let method_header = Header::new(
|
||||
|
@ -266,7 +266,7 @@ fn cors_options_bad_request_method() {
|
|||
|
||||
#[test]
|
||||
fn cors_options_bad_request_header() {
|
||||
let client = Client::new(rocket()).unwrap();
|
||||
let client = Client::tracked(rocket()).unwrap();
|
||||
|
||||
let origin_header = Header::new(ORIGIN.as_str(), "https://www.acme.com");
|
||||
let method_header = Header::new(
|
||||
|
@ -290,7 +290,7 @@ fn cors_options_bad_request_header() {
|
|||
|
||||
#[test]
|
||||
fn cors_get_bad_origin() {
|
||||
let client = Client::new(rocket()).unwrap();
|
||||
let client = Client::tracked(rocket()).unwrap();
|
||||
|
||||
let origin_header = Header::new(ORIGIN.as_str(), "https://www.bad-origin.com");
|
||||
let authorization = Header::new("Authorization", "let me in");
|
||||
|
@ -309,7 +309,7 @@ fn cors_get_bad_origin() {
|
|||
/// The route used will panic if executed
|
||||
#[test]
|
||||
fn routes_failing_checks_are_not_executed() {
|
||||
let client = Client::new(rocket()).unwrap();
|
||||
let client = Client::tracked(rocket()).unwrap();
|
||||
|
||||
let origin_header = Header::new(ORIGIN.as_str(), "https://www.bad-origin.com");
|
||||
let method_header = Header::new(
|
||||
|
@ -335,7 +335,7 @@ fn routes_failing_checks_are_not_executed() {
|
|||
#[test]
|
||||
fn cors_options_owned_check() {
|
||||
let rocket = rocket();
|
||||
let client = Client::new(rocket).unwrap();
|
||||
let client = Client::tracked(rocket).unwrap();
|
||||
|
||||
let origin_header = Header::new(ORIGIN.as_str(), "https://www.example.com");
|
||||
let method_header = Header::new(
|
||||
|
@ -364,7 +364,7 @@ fn cors_options_owned_check() {
|
|||
/// Owned manual response works
|
||||
#[test]
|
||||
fn cors_get_owned_check() {
|
||||
let client = Client::new(rocket()).unwrap();
|
||||
let client = Client::tracked(rocket()).unwrap();
|
||||
|
||||
let origin_header = Header::new(ORIGIN.as_str(), "https://www.example.com");
|
||||
let authorization = Header::new("Authorization", "let me in");
|
||||
|
|
22
tests/mix.rs
22
tests/mix.rs
|
@ -70,7 +70,7 @@ fn rocket() -> rocket::Rocket {
|
|||
|
||||
#[test]
|
||||
fn smoke_test() {
|
||||
let client = Client::new(rocket()).unwrap();
|
||||
let client = Client::tracked(rocket()).unwrap();
|
||||
|
||||
// `Options` pre-flight checks
|
||||
let origin_header = Header::new(ORIGIN.as_str(), "https://www.acme.com");
|
||||
|
@ -106,7 +106,7 @@ fn smoke_test() {
|
|||
|
||||
#[test]
|
||||
fn cors_options_check() {
|
||||
let client = Client::new(rocket()).unwrap();
|
||||
let client = Client::tracked(rocket()).unwrap();
|
||||
|
||||
let origin_header = Header::new(ORIGIN.as_str(), "https://www.acme.com");
|
||||
let method_header = Header::new(
|
||||
|
@ -132,7 +132,7 @@ fn cors_options_check() {
|
|||
|
||||
#[test]
|
||||
fn cors_get_check() {
|
||||
let client = Client::new(rocket()).unwrap();
|
||||
let client = Client::tracked(rocket()).unwrap();
|
||||
|
||||
let origin_header = Header::new(ORIGIN.as_str(), "https://www.acme.com");
|
||||
let authorization = Header::new("Authorization", "let me in");
|
||||
|
@ -152,7 +152,7 @@ fn cors_get_check() {
|
|||
/// This test is to check that non CORS compliant requests to GET should still work. (i.e. curl)
|
||||
#[test]
|
||||
fn cors_get_no_origin() {
|
||||
let client = Client::new(rocket()).unwrap();
|
||||
let client = Client::tracked(rocket()).unwrap();
|
||||
|
||||
let authorization = Header::new("Authorization", "let me in");
|
||||
let req = client.get("/").header(authorization);
|
||||
|
@ -165,7 +165,7 @@ fn cors_get_no_origin() {
|
|||
|
||||
#[test]
|
||||
fn cors_options_bad_origin() {
|
||||
let client = Client::new(rocket()).unwrap();
|
||||
let client = Client::tracked(rocket()).unwrap();
|
||||
|
||||
let origin_header = Header::new(ORIGIN.as_str(), "https://www.bad-origin.com");
|
||||
let method_header = Header::new(
|
||||
|
@ -185,7 +185,7 @@ fn cors_options_bad_origin() {
|
|||
|
||||
#[test]
|
||||
fn cors_options_missing_origin() {
|
||||
let client = Client::new(rocket()).unwrap();
|
||||
let client = Client::tracked(rocket()).unwrap();
|
||||
|
||||
let method_header = Header::new(
|
||||
ACCESS_CONTROL_REQUEST_METHOD.as_str(),
|
||||
|
@ -207,7 +207,7 @@ fn cors_options_missing_origin() {
|
|||
|
||||
#[test]
|
||||
fn cors_options_bad_request_method() {
|
||||
let client = Client::new(rocket()).unwrap();
|
||||
let client = Client::tracked(rocket()).unwrap();
|
||||
|
||||
let origin_header = Header::new(ORIGIN.as_str(), "https://www.acme.com");
|
||||
let method_header = Header::new(
|
||||
|
@ -231,7 +231,7 @@ fn cors_options_bad_request_method() {
|
|||
|
||||
#[test]
|
||||
fn cors_options_bad_request_header() {
|
||||
let client = Client::new(rocket()).unwrap();
|
||||
let client = Client::tracked(rocket()).unwrap();
|
||||
|
||||
let origin_header = Header::new(ORIGIN.as_str(), "https://www.acme.com");
|
||||
let method_header = Header::new(
|
||||
|
@ -255,7 +255,7 @@ fn cors_options_bad_request_header() {
|
|||
|
||||
#[test]
|
||||
fn cors_get_bad_origin() {
|
||||
let client = Client::new(rocket()).unwrap();
|
||||
let client = Client::tracked(rocket()).unwrap();
|
||||
|
||||
let origin_header = Header::new(ORIGIN.as_str(), "https://www.bad-origin.com");
|
||||
let authorization = Header::new("Authorization", "let me in");
|
||||
|
@ -272,7 +272,7 @@ fn cors_get_bad_origin() {
|
|||
/// Tests that the `ping` route accepts other Origins
|
||||
#[test]
|
||||
fn cors_options_ping_check() {
|
||||
let client = Client::new(rocket()).unwrap();
|
||||
let client = Client::tracked(rocket()).unwrap();
|
||||
|
||||
let origin_header = Header::new(ORIGIN.as_str(), "https://www.example.com");
|
||||
let method_header = Header::new(
|
||||
|
@ -298,7 +298,7 @@ fn cors_options_ping_check() {
|
|||
/// Tests that the `ping` route accepts other Origins
|
||||
#[test]
|
||||
fn cors_get_ping_check() {
|
||||
let client = Client::new(rocket()).unwrap();
|
||||
let client = Client::tracked(rocket()).unwrap();
|
||||
|
||||
let origin_header = Header::new(ORIGIN.as_str(), "https://www.example.com");
|
||||
|
||||
|
|
Loading…
Reference in New Issue