Update actix-web and tokio
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
5d4b90167b
commit
1ef65037a1
983
Cargo.lock
generated
983
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
11
Cargo.toml
11
Cargo.toml
@ -14,22 +14,22 @@ name = "hoc"
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
actix-rt = "2.2.0"
|
actix-rt = "2.2.0"
|
||||||
actix-web = "3.3.2"
|
actix-web = "4.0.0-beta.8"
|
||||||
badge = "0.3.0"
|
badge = "0.3.0"
|
||||||
bytes = "1.0.1"
|
bytes = "1.0.1"
|
||||||
config = { version = "0.11.0", features = ["toml"] }
|
config = { version = "0.11.0", features = ["toml"] }
|
||||||
dotenv = "0.15.0"
|
dotenv = "0.15.0"
|
||||||
futures = "0.3.15"
|
futures = "0.3.17"
|
||||||
git2 = "0.13.20"
|
git2 = "0.13.20"
|
||||||
lazy_static = "1.4.0"
|
lazy_static = "1.4.0"
|
||||||
number_prefix = "0.4.0"
|
number_prefix = "0.4.0"
|
||||||
openssl-probe = "0.1.4"
|
openssl-probe = "0.1.4"
|
||||||
reqwest = "0.10.10"
|
reqwest = "0.11.4"
|
||||||
serde = "1.0.126"
|
serde = "1.0.126"
|
||||||
serde_derive = "1.0.123"
|
serde_derive = "1.0.123"
|
||||||
serde_json = "1.0.64"
|
serde_json = "1.0.64"
|
||||||
tracing = "0.1.26"
|
tracing = "0.1.26"
|
||||||
tracing-actix-web = "0.2.1"
|
tracing-actix-web = "0.4.0-beta.11"
|
||||||
tracing-bunyan-formatter = "0.2.4"
|
tracing-bunyan-formatter = "0.2.4"
|
||||||
tracing-futures = "0.2.5"
|
tracing-futures = "0.2.5"
|
||||||
tracing-log = "0.1.2"
|
tracing-log = "0.1.2"
|
||||||
@ -40,6 +40,7 @@ ructe = "0.13.4"
|
|||||||
vergen = { version = "5.1.13", default-features = false, features = ["git"] }
|
vergen = { version = "5.1.13", default-features = false, features = ["git"] }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
|
awc = "3.0.0-beta.7"
|
||||||
ructe = "0.13.4"
|
ructe = "0.13.4"
|
||||||
tempfile = "3.2.0"
|
tempfile = "3.2.0"
|
||||||
tokio = "0.2.25"
|
tokio = "1.11.0"
|
||||||
|
14
src/lib.rs
14
src/lib.rs
@ -29,7 +29,7 @@ use crate::{
|
|||||||
use actix_web::{
|
use actix_web::{
|
||||||
dev::Server,
|
dev::Server,
|
||||||
http::header::{CacheControl, CacheDirective, Expires, LOCATION},
|
http::header::{CacheControl, CacheDirective, Expires, LOCATION},
|
||||||
middleware::{self, normalize::TrailingSlash},
|
middleware::{self, TrailingSlash},
|
||||||
web, App, HttpResponse, HttpServer, Responder,
|
web, App, HttpResponse, HttpServer, Responder,
|
||||||
};
|
};
|
||||||
use badge::{Badge, BadgeOptions};
|
use badge::{Badge, BadgeOptions};
|
||||||
@ -224,10 +224,10 @@ where
|
|||||||
})?;
|
})?;
|
||||||
repo_count.fetch_sub(1, Ordering::Relaxed);
|
repo_count.fetch_sub(1, Ordering::Relaxed);
|
||||||
Ok(HttpResponse::TemporaryRedirect()
|
Ok(HttpResponse::TemporaryRedirect()
|
||||||
.header(
|
.insert_header((
|
||||||
LOCATION,
|
LOCATION,
|
||||||
format!("/{}/{}/{}/view", T::url_path(), data.0, data.1),
|
format!("/{}/{}/{}/view", T::url_path(), data.0, data.1),
|
||||||
)
|
))
|
||||||
.finish())
|
.finish())
|
||||||
};
|
};
|
||||||
future.instrument(span).await
|
future.instrument(span).await
|
||||||
@ -318,8 +318,8 @@ fn no_cache_response(body: Vec<u8>) -> HttpResponse {
|
|||||||
let expiration = SystemTime::now() + Duration::from_secs(30);
|
let expiration = SystemTime::now() + Duration::from_secs(30);
|
||||||
HttpResponse::Ok()
|
HttpResponse::Ok()
|
||||||
.content_type("image/svg+xml")
|
.content_type("image/svg+xml")
|
||||||
.set(Expires(expiration.into()))
|
.insert_header(Expires(expiration.into()))
|
||||||
.set(CacheControl(vec![
|
.insert_header(CacheControl(vec![
|
||||||
CacheDirective::MaxAge(0u32),
|
CacheDirective::MaxAge(0u32),
|
||||||
CacheDirective::MustRevalidate,
|
CacheDirective::MustRevalidate,
|
||||||
CacheDirective::NoCache,
|
CacheDirective::NoCache,
|
||||||
@ -480,7 +480,7 @@ async fn start_server(listener: TcpListener, settings: Settings) -> std::io::Res
|
|||||||
App::new()
|
App::new()
|
||||||
.app_data(state.clone())
|
.app_data(state.clone())
|
||||||
.app_data(repo_count.clone())
|
.app_data(repo_count.clone())
|
||||||
.wrap(tracing_actix_web::TracingLogger)
|
.wrap(tracing_actix_web::TracingLogger::default())
|
||||||
.wrap(middleware::NormalizePath::new(TrailingSlash::Trim))
|
.wrap(middleware::NormalizePath::new(TrailingSlash::Trim))
|
||||||
.service(index)
|
.service(index)
|
||||||
.service(health_check)
|
.service(health_check)
|
||||||
@ -518,7 +518,7 @@ async fn start_server(listener: TcpListener, settings: Settings) -> std::io::Res
|
|||||||
.service(web::resource("/gitlab/{user}/{repo}/view").to(overview::<Gitlab>))
|
.service(web::resource("/gitlab/{user}/{repo}/view").to(overview::<Gitlab>))
|
||||||
.service(web::resource("/bitbucket/{user}/{repo}/view").to(overview::<Bitbucket>))
|
.service(web::resource("/bitbucket/{user}/{repo}/view").to(overview::<Bitbucket>))
|
||||||
.service(web::resource("/sourcehut/{user}/{repo}/view").to(overview::<Sourcehut>))
|
.service(web::resource("/sourcehut/{user}/{repo}/view").to(overview::<Sourcehut>))
|
||||||
.default_service(web::resource("").route(web::get().to(async_p404)))
|
.default_service(web::to(async_p404))
|
||||||
})
|
})
|
||||||
.workers(workers)
|
.workers(workers)
|
||||||
.listen(listener)?
|
.listen(listener)?
|
||||||
|
@ -1,12 +1,10 @@
|
|||||||
mod util;
|
mod util;
|
||||||
|
|
||||||
use actix_web::client;
|
|
||||||
|
|
||||||
#[actix_rt::test]
|
#[actix_rt::test]
|
||||||
async fn badge_succeeds() {
|
async fn badge_succeeds() {
|
||||||
let test_app = util::spawn_app().await;
|
let test_app = util::spawn_app().await;
|
||||||
|
|
||||||
let client = client::Client::default();
|
let client = awc::Client::default();
|
||||||
|
|
||||||
let response = client
|
let response = client
|
||||||
.get(&format!("{}/github/vbrandl/hoc", test_app.address))
|
.get(&format!("{}/github/vbrandl/hoc", test_app.address))
|
||||||
|
@ -1,12 +1,10 @@
|
|||||||
mod util;
|
mod util;
|
||||||
|
|
||||||
use actix_web::client;
|
|
||||||
|
|
||||||
#[actix_rt::test]
|
#[actix_rt::test]
|
||||||
async fn health_check_works() {
|
async fn health_check_works() {
|
||||||
let test_app = util::spawn_app().await;
|
let test_app = util::spawn_app().await;
|
||||||
|
|
||||||
let client = client::Client::default();
|
let client = awc::Client::default();
|
||||||
|
|
||||||
let response = client
|
let response = client
|
||||||
.get(&format!("{}/health_check", test_app.address))
|
.get(&format!("{}/health_check", test_app.address))
|
||||||
|
@ -1,12 +1,10 @@
|
|||||||
mod util;
|
mod util;
|
||||||
|
|
||||||
use actix_web::client;
|
|
||||||
|
|
||||||
#[actix_rt::test]
|
#[actix_rt::test]
|
||||||
async fn index_returns_success() {
|
async fn index_returns_success() {
|
||||||
let test_app = util::spawn_app().await;
|
let test_app = util::spawn_app().await;
|
||||||
|
|
||||||
let client = client::Client::default();
|
let client = awc::Client::default();
|
||||||
|
|
||||||
let response = client
|
let response = client
|
||||||
.get(&format!("{}/", test_app.address))
|
.get(&format!("{}/", test_app.address))
|
||||||
|
@ -1,12 +1,10 @@
|
|||||||
mod util;
|
mod util;
|
||||||
|
|
||||||
use actix_web::client;
|
|
||||||
|
|
||||||
#[actix_rt::test]
|
#[actix_rt::test]
|
||||||
async fn json_returns_success() {
|
async fn json_returns_success() {
|
||||||
let test_app = util::spawn_app().await;
|
let test_app = util::spawn_app().await;
|
||||||
|
|
||||||
let client = client::Client::default();
|
let client = awc::Client::default();
|
||||||
|
|
||||||
let response = client
|
let response = client
|
||||||
.get(&format!("{}/github/vbrandl/hoc/json", test_app.address))
|
.get(&format!("{}/github/vbrandl/hoc/json", test_app.address))
|
||||||
|
Loading…
Reference in New Issue
Block a user