diff --git a/Cargo.lock b/Cargo.lock index ce507a4..cb5cd20 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -27,9 +27,9 @@ dependencies = [ [[package]] name = "actix-http" -version = "3.0.0-beta.19" +version = "3.0.0-rc.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae58d21721388ea9b2cd0d4c11756b0f34424cdcd6e5cc74c3ce37b4641c8af0" +checksum = "08aac516b88cb8cfbfa834c76b58607ffac75946d947dcb6a9ffc5673e1e875d" dependencies = [ "actix-codec", "actix-rt", @@ -74,9 +74,9 @@ dependencies = [ [[package]] name = "actix-router" -version = "0.5.0-rc.2" +version = "0.5.0-rc.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e0b59ad08167ffbb686ddb495846707231e96908b829b1fc218198ec581e2ad" +checksum = "cb6506dbef336634ff35d994d58daa0a412ea23751f15f9b4dcac4d594b1ed1f" dependencies = [ "bytestring", "firestorm", @@ -155,9 +155,9 @@ dependencies = [ [[package]] name = "actix-web" -version = "4.0.0-beta.21" +version = "4.0.0-rc.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "606fc29a9bde2907243086ceb93ce56df7584276c2c46abc64a524f645c63c5e" +checksum = "d7bfa913583b6cfe5f0d1588e752bcf6b107556422624fefdaf99c40ba2b7f16" dependencies = [ "actix-codec", "actix-http", @@ -194,9 +194,9 @@ dependencies = [ [[package]] name = "actix-web-codegen" -version = "0.5.0-rc.1" +version = "0.5.0-rc.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98a793e4a7bd059e06e1bc1bd9943b57a47f806de3599d2437441682292c333e" +checksum = "4d0976042e6ddc82c7d0dedd64d39959bc26d9bba098b2f6c32a73fbef784eaf" dependencies = [ "actix-router", "proc-macro2", @@ -274,9 +274,9 @@ checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" [[package]] name = "awc" -version = "3.0.0-beta.19" +version = "3.0.0-beta.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a4cf9b623ee9974723a10c77a3b8c1060ac2d6cfe6d3326512bbc50fe36fad8" +checksum = "4a64a95bbf4905fd057ea45b70fdfeeb9c7ae09f03f091642c4e66a16ebb3ad5" dependencies = [ "actix-codec", "actix-http", @@ -1656,9 +1656,9 @@ checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" [[package]] name = "security-framework" -version = "2.5.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d09d3c15d814eda1d6a836f2f2b56a6abc1446c8a34351cb3180d3db92ffe4ce" +checksum = "3fed7948b6c68acbb6e20c334f55ad635dc0f75506963de4464289fbd3b051ac" dependencies = [ "bitflags", "core-foundation", @@ -1669,9 +1669,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.5.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e90dd10c41c6bfc633da6e0c659bd25d31e0791e5974ac42970267d59eba87f7" +checksum = "a57321bf8bc2362081b2599912d2961fe899c0efadf1b4b2f8d48b3e253bb96c" dependencies = [ "core-foundation-sys", "libc", @@ -1975,9 +1975,9 @@ dependencies = [ [[package]] name = "tracing-actix-web" -version = "0.5.0-beta.11" +version = "0.5.0-rc.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71f2dfaaf009c5e9786e2f2dfbde63d5fa44409434d64190abfef5ade67d89b1" +checksum = "0066b8102bdd05325d02966fac8b5e360eafd8dcdf81006c4d30f3543f488714" dependencies = [ "actix-web", "pin-project", diff --git a/Cargo.toml b/Cargo.toml index df05f15..b1b74c3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,7 +14,7 @@ name = "hoc" [dependencies] actix-rt = "2.6.0" -actix-web = "4.0.0-beta.21" +actix-web = "4.0.0-rc.1" badge = "0.3.0" bytes = "1.1.0" config = { version = "0.11.0", features = ["toml"] } @@ -29,7 +29,7 @@ serde = "1.0.136" serde_derive = "1.0.136" serde_json = "1.0.78" tracing = "0.1.29" -tracing-actix-web = "0.5.0-beta.11" +tracing-actix-web = "0.5.0-rc.1" tracing-bunyan-formatter = "0.3.2" tracing-futures = "0.2.5" tracing-log = "0.1.2" @@ -40,7 +40,7 @@ ructe = "0.13.4" vergen = { version = "6.0.2", default-features = false, features = ["git"] } [dev-dependencies] -awc = "3.0.0-beta.19" +awc = "3.0.0-beta.20" ructe = "0.13.4" tempfile = "3.3.0" tokio = "1.16.1" diff --git a/src/lib.rs b/src/lib.rs index 301b000..5171f0b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -462,11 +462,11 @@ async fn async_p404(repo_count: web::Data) -> Result p404(repo_count) } -fn css() -> HttpResponse { +async fn css() -> HttpResponse { HttpResponse::Ok().content_type("text/css").body(CSS) } -fn favicon32() -> HttpResponse { +async fn favicon32() -> HttpResponse { HttpResponse::Ok().content_type("image/png").body(FAVICON) } @@ -491,8 +491,7 @@ async fn start_server(listener: TcpListener, settings: Settings) -> std::io::Res let app = GitHub::register_service(app); let app = Gitlab::register_service(app); let app = Bitbucket::register_service(app); - let app = Sourcehut::register_service(app); - app + Sourcehut::register_service(app) }) .workers(workers) .listen(listener)? diff --git a/tests/resources.rs b/tests/resources.rs new file mode 100644 index 0000000..9765f3c --- /dev/null +++ b/tests/resources.rs @@ -0,0 +1,31 @@ +mod util; + +#[actix_rt::test] +async fn favicon() { + let test_app = util::spawn_app().await; + + let client = awc::Client::default(); + + let response = client + .get(&format!("{}/favicon.ico", test_app.address)) + .send() + .await + .expect("Failed to execute request"); + + assert!(response.status().is_success()); +} + +#[actix_rt::test] +async fn tacit_css() { + let test_app = util::spawn_app().await; + + let client = awc::Client::default(); + + let response = client + .get(&format!("{}/tacit-css.min.css", test_app.address)) + .send() + .await + .expect("Failed to execute request"); + + assert!(response.status().is_success()); +}