Skip to content

Commit 94052ae

Browse files
committed
bugfix: fix cors error and allow TR-QueryId to be returned through CORS
1 parent c239164 commit 94052ae

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

server/src/lib.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -664,7 +664,10 @@ pub fn main() -> std::io::Result<()> {
664664

665665
HttpServer::new(move || {
666666
App::new()
667-
.wrap(Cors::permissive())
667+
.wrap(
668+
Cors::permissive()
669+
.allowed_header("TR-QueryId")
670+
)
668671
.app_data(PayloadConfig::new(134200000))
669672
.wrap(middleware::json_middleware::JsonMiddlewareFactory)
670673
.app_data(json_cfg.clone())

server/src/operators/message_operator.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -717,7 +717,7 @@ pub async fn stream_response(
717717
}
718718

719719
Ok(HttpResponse::Ok()
720-
.insert_header(("X-TR-QueryID", query_id.to_string()))
720+
.insert_header(("TR-QueryID", query_id.to_string()))
721721
.streaming(chunk_stream.chain(completion_stream)))
722722
}
723723

0 commit comments

Comments
 (0)