11use std:: collections:: HashMap ;
22
3- use actix_web:: web:: Query ;
3+ use actix_web:: web:: { Query , ReqData } ;
44use actix_web:: {
55 HttpRequest , Responder ,
66 web:: { Data , Json , Path } ,
77} ;
8- use tracing:: info;
9- use tracing:: instrument;
10-
118use htsget_http:: { Endpoint , PostRequest , post} ;
129use htsget_search:: HtsGet ;
10+ use serde_json:: Value ;
11+ use tracing:: info;
12+ use tracing:: instrument;
1313
14+ use super :: { extract_request, handle_response} ;
1415use 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) ) ]
2119pub 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) ) ]
4546pub 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 )
0 commit comments