@@ -25,7 +25,12 @@ use crate::{
2525 service:: SbomService ,
2626 } ,
2727} ;
28- use actix_web:: { HttpResponse , Responder , delete, get, http:: header, post, web, web:: BytesMut } ;
28+ use actix_web:: {
29+ HttpResponse , Responder , delete, get,
30+ http:: header:: { self , ContentType } ,
31+ post,
32+ web:: { self , BytesMut } ,
33+ } ;
2934use config:: Config ;
3035use futures_util:: TryStreamExt ;
3136use sea_orm:: { TransactionTrait , prelude:: Uuid } ;
@@ -556,7 +561,7 @@ pub async fn create_exploitiq_report(
556561 let buf = s. try_collect :: < BytesMut > ( ) . await ?;
557562 let sbom: serde_json:: Value = serde_json:: from_slice ( buf. as_ref ( ) ) ?;
558563 let req = ExploitIqRequest :: new ( sbom, vulnerabilities) ;
559- HttpResponse :: Ok ( ) . json ( create_report ( req) . await ?)
564+ HttpResponse :: Created ( ) . json ( create_report ( req) . await ?)
560565 }
561566 None => HttpResponse :: NotFound ( ) . finish ( ) ,
562567 } ) ,
@@ -572,11 +577,14 @@ pub async fn create_exploitiq_report(
572577 ( "id" = String , description = "ExploitIQ report id" ) ,
573578 ) ,
574579 responses(
575- ( status = 200 , description = "The proxied ExploitIQ report" , body = inline ( BinaryData ) ) ,
580+ ( status = 200 , description = "The proxied ExploitIQ report" , body = serde_json :: Value ) ,
576581 )
577582) ]
578583#[ get( "/v2/sbom/exploitiq/{id}" ) ]
579584pub async fn fetch_exploitiq_report ( id : web:: Path < String > ) -> Result < impl Responder , Error > {
580585 let id = id. into_inner ( ) ;
581- Ok ( HttpResponse :: Ok ( ) . streaming ( fetch_report ( id) . await ?) )
586+ let stream = fetch_report ( id) . await ?;
587+ Ok ( HttpResponse :: Ok ( )
588+ . content_type ( ContentType :: json ( ) )
589+ . streaming ( stream) )
582590}
0 commit comments