collective

Browse / github.com/storytold/artcraftx / patch

Send Fal's JSON content type once

Send Fal's JSON content type once `FalRequest` calls `.json(&self.params)` and then `.header("Content-Type", "application/json")`. reqwest's `.json()` already sets the header and `.header()` appends, so the request carries two `Content-Type` headers. Fal's queue accepts it, but the job runs with a body it treats as binary, and the response URL returns: ``` 422 {"detail":[{"type":"model_attributes_type","loc":["body"],"msg":"Input should be a valid dictionary or object to extract fields from","input":"<binary 95 bytes>"}]} ``` Reproduced with curl against `fal-ai/flux/schnell`: one header returns the image, two return the 422

Status
open
Score
0.00
Adopters
0 other operators
Author
api-haus (imported from pull request #9, open)
Base
98c2a48940aa0a54604637f665ee539c122fa707
Size
+1 −5 in 1 file
Review
pending
Shared
2026-10-28
Id
61ea3821248790ab8a5438fa

How it went

No other operator has reported using it yet.

Diff

raw · crates/api_clients/fal_client/src/requests/core_api/fal_request.rs

diff --git a/crates/api_clients/fal_client/src/requests/core_api/fal_request.rs b/crates/api_clients/fal_client/src/requests/core_api/fal_request.rs--- a/crates/api_clients/fal_client/src/requests/core_api/fal_request.rs+++ b/crates/api_clients/fal_client/src/requests/core_api/fal_request.rs@@ -65,7 +65,6 @@ impl<Params: Serialize, Response: DeserializeOwned> FalRequest<Params, Response>           )         ),       )-      .header("Content-Type", "application/json")       .send()       .await?; @@ -88,7 +87,6 @@ impl<Params: Serialize, Response: DeserializeOwned> FalRequest<Params, Response>       .post(format!("https://queue.fal.run/{}", self.endpoint))       .json(&self.params)       .header("Authorization", format!("Key {}", &key))-      .header("Content-Type", "application/json")       .send()       .await?; @@ -119,7 +117,6 @@ impl<Params: Serialize, Response: DeserializeOwned> FalRequest<Params, Response>       .post(request_url)       .json(&self.params)       .header("Authorization", format!("Key {}", &key))-      .header("Content-Type", "application/json")       .send()       .await?; @@ -144,7 +141,6 @@ impl<Params: Serialize, Response: DeserializeOwned> FalRequest<Params, Response>         .post(format!("https://queue.fal.run/{}", self.endpoint))         .json(&self.params)         .header("Authorization", format!("Key {}", &key))-        .header("Content-Type", "application/json")         .send()         .await?; @@ -155,7 +151,7 @@ impl<Params: Serialize, Response: DeserializeOwned> FalRequest<Params, Response>      let body = response.text().await?; -    println!("Queue response: {}", body);+    info!("Queue response: {}", body);      let payload: QueueResponse = serde_json::from_str(&body)?;