Skip to content

Commit 7e70e93

Browse files
committed
fix: properly specify content type in OR
1 parent 0a7d1f6 commit 7e70e93

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

backend/src/openrouter/openrouter.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ use crate::openrouter::{StreamCompletion, option::CompletionOption};
44
use super::capability::CapabilityResolver;
55
use super::model_cache::ModelCacheManager;
66
use super::{Model, error::Error, raw};
7+
use http::header::CONTENT_TYPE;
78
use protocol::OcrEngine;
89

910
use super::HTTP_REFERER;
@@ -206,6 +207,7 @@ impl Openrouter {
206207
.bearer_auth(&self.api_key)
207208
.header("HTTP-Referer", HTTP_REFERER)
208209
.header("X-Title", X_TITLE)
210+
.header(CONTENT_TYPE, "application/json")
209211
.json(&req)
210212
.send()
211213
.await
@@ -345,6 +347,7 @@ impl Openrouter {
345347
.bearer_auth(&self.api_key)
346348
.header("HTTP-Referer", HTTP_REFERER)
347349
.header("X-Title", X_TITLE)
350+
.header(CONTENT_TYPE, "application/json")
348351
.json(&req)
349352
.send()
350353
.await

backend/src/openrouter/stream.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use std::{collections::VecDeque, pin::Pin, task};
22

33
use futures_util::FutureExt;
4+
use http::header::CONTENT_TYPE;
45
use reqwest::Client;
56
use reqwest_eventsource::{Event, EventSource};
67
use tokio_stream::{Stream, StreamExt};
@@ -80,6 +81,7 @@ impl StreamCompletion {
8081
.bearer_auth(api_key)
8182
.header("HTTP-Referer", HTTP_REFERER)
8283
.header("X-Title", X_TITLE)
84+
.header(CONTENT_TYPE, "application/json")
8385
.json(&req);
8486

8587
match EventSource::new(builder) {

0 commit comments

Comments
 (0)