From dc76edde0d3033f134a0a6c7d8e2796090f3c285 Mon Sep 17 00:00:00 2001 From: Tom Deckers Date: Wed, 25 Jun 2025 16:41:35 +0200 Subject: [PATCH] fix(backend): return correct content-type for openapi spec (#6045) --- backend/windmill-api/src/lib.rs | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/backend/windmill-api/src/lib.rs b/backend/windmill-api/src/lib.rs index a415803339..ee03ff1825 100644 --- a/backend/windmill-api/src/lib.rs +++ b/backend/windmill-api/src/lib.rs @@ -36,8 +36,10 @@ use anyhow::Context; use argon2::Argon2; use axum::extract::DefaultBodyLimit; use axum::{middleware::from_extractor, routing::get, routing::post, Extension, Router}; +use axum::response::Response; +use axum::http::HeaderValue; +use axum::body::Body; use db::DB; -use http::HeaderValue; use reqwest::Client; #[cfg(feature = "oauth2")] use std::collections::HashMap; @@ -890,12 +892,18 @@ async fn ee_license() -> String { } } -async fn openapi() -> &'static str { - include_str!("../openapi-deref.yaml") +async fn openapi() -> Response { + Response::builder() + .header("content-type", "application/yaml") + .body(Body::from(include_str!("../openapi-deref.yaml"))) + .unwrap() } -async fn openapi_json() -> &'static str { - include_str!("../openapi-deref.json") +async fn openapi_json() -> Response { + Response::builder() + .header("content-type", "application/json") + .body(Body::from(include_str!("../openapi-deref.json"))) + .unwrap() } pub async fn migrate_db(db: &DB) -> anyhow::Result>> {