Skip to content

Commit 389454f

Browse files
authored
fix(verification): send content type (#382)
Signed-off-by: Will Burford <will@lmstudio.ai>
1 parent 0463046 commit 389454f

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

crates/openshell-router/src/backend.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ pub async fn verify_backend_endpoint(
224224
route: &ResolvedRoute,
225225
) -> Result<ValidatedEndpoint, ValidationFailure> {
226226
let probe = validation_probe(route)?;
227+
let headers = vec![("content-type".to_string(), "application/json".to_string())];
227228

228229
if mock::is_mock_route(route) {
229230
return Ok(ValidatedEndpoint {
@@ -232,7 +233,7 @@ pub async fn verify_backend_endpoint(
232233
});
233234
}
234235

235-
let response = send_backend_request(client, route, "POST", probe.path, Vec::new(), probe.body)
236+
let response = send_backend_request(client, route, "POST", probe.path, headers, probe.body)
236237
.await
237238
.map_err(|err| match err {
238239
RouterError::UpstreamUnavailable(details) => ValidationFailure {
@@ -429,6 +430,7 @@ mod tests {
429430
Mock::given(method("POST"))
430431
.and(path("/v1/messages"))
431432
.and(header("x-api-key", "sk-test"))
433+
.and(header("content-type", "application/json"))
432434
.and(header("anthropic-version", "2023-06-01"))
433435
.and(body_partial_json(serde_json::json!({
434436
"model": "test-model",

crates/openshell-server/src/inference.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -851,6 +851,7 @@ mod tests {
851851
Mock::given(method("POST"))
852852
.and(path("/v1/chat/completions"))
853853
.and(header("authorization", "Bearer sk-test"))
854+
.and(header("content-type", "application/json"))
854855
.and(body_partial_json(serde_json::json!({
855856
"model": "gpt-4o-mini",
856857
"max_tokens": 1,

0 commit comments

Comments
 (0)