Skip to content

Commit c253722

Browse files
committed
Merge branch 'main' of https://github.com/umccr/htsget-rs into feature/aws-vpc-lattice-support
# Conflicts: # Cargo.lock # htsget-lambda/src/main.rs
2 parents c28a1bb + 1efdd58 commit c253722

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+4914
-1898
lines changed

Cargo.lock

Lines changed: 713 additions & 529 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

htsget-actix/CHANGELOG.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,30 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [0.11.2](https://github.com/umccr/htsget-rs/compare/htsget-actix-v0.11.1...htsget-actix-v0.11.2) - 2025-09-03
11+
12+
### Added
13+
14+
- add auth logic to post requests and always allow headers to succeed
15+
- add suppressed errors options to axum and actix ticket servers
16+
17+
## [0.11.1](https://github.com/umccr/htsget-rs/compare/htsget-actix-v0.11.0...htsget-actix-v0.11.1) - 2025-08-21
18+
19+
### Other
20+
21+
- update Cargo.lock dependencies
22+
23+
## [0.11.0](https://github.com/umccr/htsget-rs/compare/htsget-actix-v0.10.0...htsget-actix-v0.11.0) - 2025-08-15
24+
25+
### Fixed
26+
27+
- [**breaking**] add restrictions to file locations and ensure that the data server local path lines up as expected
28+
29+
### Other
30+
31+
- remove duplicate changelog section
32+
- Merge pull request #320 from umccr/feat/auth
33+
1034
## [0.10.0](https://github.com/umccr/htsget-rs/compare/htsget-actix-v0.9.0...htsget-actix-v0.10.0) - 2025-08-11
1135

1236
### Added

htsget-actix/Cargo.toml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "htsget-actix"
3-
version = "0.10.0"
3+
version = "0.11.2"
44
rust-version = "1.86"
55
authors = ["Daniel del Castillo de la Rosa <[email protected]>", "Marko Malenic <[email protected]>", "Roman Valls Guimera <[email protected]>"]
66
edition = "2024"
@@ -26,6 +26,7 @@ default = []
2626
actix-web = { version = "4", features = ["rustls-0_23"] }
2727
rustls = "0.23"
2828
actix-cors = "0.7"
29+
actix-utils = "3"
2930
http_1 = { package = "http", version = "1" }
3031
http = "0.2"
3132
serde = { version = "1", features = ["derive"] }
@@ -39,10 +40,10 @@ axum = { version = "0.8", features = ["http2"] }
3940
tracing-actix-web = "0.7"
4041
tracing = "0.1"
4142

42-
htsget-http = { version = "0.7.0", path = "../htsget-http", default-features = false }
43-
htsget-search = { version = "0.11.1", path = "../htsget-search", default-features = false }
44-
htsget-config = { version = "0.15.1", path = "../htsget-config", default-features = false }
45-
htsget-axum = { version = "0.5.0", path = "../htsget-axum", default-features = false }
43+
htsget-http = { version = "0.7.3", path = "../htsget-http", default-features = false }
44+
htsget-search = { version = "0.11.4", path = "../htsget-search", default-features = false }
45+
htsget-config = { version = "0.17.0", path = "../htsget-config", default-features = false }
46+
htsget-axum = { version = "0.6.2", path = "../htsget-axum", default-features = false }
4647

4748
[dev-dependencies]
4849
htsget-test = { path = "../htsget-test", features = ["http"], default-features = false }

htsget-actix/benches/request_benchmarks.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,7 @@ fn criterion_benchmark(c: &mut Criterion) {
230230
tags: None,
231231
notags: None,
232232
regions: None,
233+
encryption_scheme: None,
233234
};
234235
bench_pair(
235236
&mut group,
@@ -250,6 +251,7 @@ fn criterion_benchmark(c: &mut Criterion) {
250251
start: None,
251252
end: None,
252253
}]),
254+
encryption_scheme: None,
253255
};
254256
bench_pair(
255257
&mut group,
@@ -277,6 +279,7 @@ fn criterion_benchmark(c: &mut Criterion) {
277279
end: Some(5008321),
278280
},
279281
]),
282+
encryption_scheme: None,
280283
};
281284
bench_pair(
282285
&mut group,
@@ -297,6 +300,7 @@ fn criterion_benchmark(c: &mut Criterion) {
297300
start: Some(1),
298301
end: Some(153),
299302
}]),
303+
encryption_scheme: None,
300304
};
301305
bench_pair(
302306
&mut group,
@@ -317,6 +321,7 @@ fn criterion_benchmark(c: &mut Criterion) {
317321
start: None,
318322
end: None,
319323
}]),
324+
encryption_scheme: None,
320325
};
321326
bench_pair(
322327
&mut group,

htsget-actix/src/handlers/get.rs

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,43 @@
11
use std::collections::HashMap;
22

3+
use actix_web::web::ReqData;
34
use actix_web::{
45
HttpRequest, Responder,
56
web::{Data, Path, Query},
67
};
7-
use tracing::info;
8-
use tracing::instrument;
9-
108
use htsget_http::{Endpoint, get};
119
use htsget_search::HtsGet;
10+
use serde_json::Value;
11+
use tracing::info;
12+
use tracing::instrument;
1213

14+
use super::handle_response;
1315
use crate::AppState;
1416
use crate::handlers::extract_request;
1517

16-
use super::handle_response;
17-
1818
/// GET request reads endpoint
1919
#[instrument(skip(app_state))]
2020
pub async fn reads<H: HtsGet + Clone + Send + Sync + 'static>(
2121
request: Query<HashMap<String, String>>,
2222
path: Path<String>,
2323
http_request: HttpRequest,
24+
extension: Option<ReqData<Value>>,
2425
app_state: Data<AppState<H>>,
2526
) -> impl Responder {
2627
let request = extract_request(request, path, http_request);
2728

2829
info!(request = ?request, "reads endpoint GET request");
2930

30-
handle_response(get(app_state.get_ref().htsget.clone(), request, Endpoint::Reads).await)
31+
handle_response(
32+
get(
33+
app_state.get_ref().htsget.clone(),
34+
request,
35+
Endpoint::Reads,
36+
app_state.auth.clone(),
37+
extension.map(|extension| extension.into_inner()),
38+
)
39+
.await,
40+
)
3141
}
3242

3343
/// GET request variants endpoint
@@ -36,6 +46,7 @@ pub async fn variants<H: HtsGet + Clone + Send + Sync + 'static>(
3646
request: Query<HashMap<String, String>>,
3747
path: Path<String>,
3848
http_request: HttpRequest,
49+
extension: Option<ReqData<Value>>,
3950
app_state: Data<AppState<H>>,
4051
) -> impl Responder {
4152
let request = extract_request(request, path, http_request);
@@ -47,6 +58,8 @@ pub async fn variants<H: HtsGet + Clone + Send + Sync + 'static>(
4758
app_state.get_ref().htsget.clone(),
4859
request,
4960
Endpoint::Variants,
61+
app_state.auth.clone(),
62+
extension.map(|extension| extension.into_inner()),
5063
)
5164
.await,
5265
)

htsget-actix/src/handlers/mod.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@ use std::collections::HashMap;
22

33
use actix_web::web::{Path, Query};
44
use actix_web::{Either, HttpRequest, Responder, http::StatusCode};
5-
use http::{HeaderMap as HttpHeaderMap, HeaderName, Method};
6-
75
use htsget_config::types::{JsonResponse, Request};
86
use htsget_http::Result;
7+
use http::{HeaderMap as HttpHeaderMap, HeaderName, Method};
98
use pretty_json::PrettyJson;
109

1110
pub use crate::handlers::service_info::{
@@ -16,7 +15,7 @@ pub mod get;
1615
pub mod post;
1716
pub mod service_info;
1817

19-
mod pretty_json;
18+
pub(crate) mod pretty_json;
2019

2120
pub(crate) struct HeaderMap(HttpHeaderMap);
2221

htsget-actix/src/handlers/post.rs

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,27 @@
11
use std::collections::HashMap;
22

3-
use actix_web::web::Query;
3+
use actix_web::web::{Query, ReqData};
44
use actix_web::{
55
HttpRequest, Responder,
66
web::{Data, Json, Path},
77
};
8-
use tracing::info;
9-
use tracing::instrument;
10-
118
use htsget_http::{Endpoint, PostRequest, post};
129
use htsget_search::HtsGet;
10+
use serde_json::Value;
11+
use tracing::info;
12+
use tracing::instrument;
1313

14+
use super::{extract_request, handle_response};
1415
use crate::AppState;
15-
use crate::handlers::extract_request;
16-
17-
use super::handle_response;
1816

1917
/// POST request reads endpoint
2018
#[instrument(skip(app_state))]
2119
pub async fn reads<H: HtsGet + Clone + Send + Sync + 'static>(
2220
request: Query<HashMap<String, String>>,
23-
body: Json<PostRequest>,
2421
path: Path<String>,
2522
http_request: HttpRequest,
23+
extension: Option<ReqData<Value>>,
24+
body: Json<PostRequest>,
2625
app_state: Data<AppState<H>>,
2726
) -> impl Responder {
2827
let request = extract_request(request, path, http_request);
@@ -35,6 +34,8 @@ pub async fn reads<H: HtsGet + Clone + Send + Sync + 'static>(
3534
body.into_inner(),
3635
request,
3736
Endpoint::Reads,
37+
app_state.auth.clone(),
38+
extension.map(|extension| extension.into_inner()),
3839
)
3940
.await,
4041
)
@@ -44,9 +45,10 @@ pub async fn reads<H: HtsGet + Clone + Send + Sync + 'static>(
4445
#[instrument(skip(app_state))]
4546
pub async fn variants<H: HtsGet + Clone + Send + Sync + 'static>(
4647
request: Query<HashMap<String, String>>,
47-
body: Json<PostRequest>,
4848
path: Path<String>,
4949
http_request: HttpRequest,
50+
extension: Option<ReqData<Value>>,
51+
body: Json<PostRequest>,
5052
app_state: Data<AppState<H>>,
5153
) -> impl Responder {
5254
let request = extract_request(request, path, http_request);
@@ -59,6 +61,8 @@ pub async fn variants<H: HtsGet + Clone + Send + Sync + 'static>(
5961
body.into_inner(),
6062
request,
6163
Endpoint::Variants,
64+
app_state.auth.clone(),
65+
extension.map(|extension| extension.into_inner()),
6266
)
6367
.await,
6468
)

htsget-actix/src/handlers/pretty_json.rs

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,28 @@ use serde::Serialize;
44

55
pub struct PrettyJson<T>(pub T);
66

7+
impl<T> TryFrom<PrettyJson<T>> for String
8+
where
9+
T: Serialize,
10+
{
11+
type Error = serde_json::Error;
12+
13+
fn try_from(json: PrettyJson<T>) -> Result<Self, Self::Error> {
14+
let mut body = serde_json::to_string_pretty(&json.0)?;
15+
body.push('\n');
16+
17+
Ok(body)
18+
}
19+
}
20+
721
impl<T: Serialize> Responder for PrettyJson<T> {
822
type Body = BoxBody;
923

1024
fn respond_to(self, _: &HttpRequest) -> HttpResponse {
11-
let mut body = match serde_json::to_string_pretty(&self.0) {
25+
let body = match String::try_from(self) {
1226
Ok(body) => body,
13-
Err(e) => return HttpResponse::from_error(e),
27+
Err(err) => return HttpResponse::from_error(err),
1428
};
15-
body.push('\n');
1629

1730
HttpResponse::build(StatusCode::OK)
1831
.content_type("application/json")

0 commit comments

Comments
 (0)