Skip to content

multi-part not working when setting content-type manually #79

@behrica

Description

@behrica

I had a very strange issue, and it took me a long time to figure it out, so want to report it here.

When doing this request:

(def base-url "https://xxxxxx.westeurope.azurecontainerapps.io")
;(def base-url "http://localhost:5000")

(hc/post (format "/data-extraction?model_id=GPT-5.1" base-url)
              {
                 ;:headers {"Content-Type" "multipart/form-data"}
               :multipart [
                           {:name "prompt-template" :content prompt-template}
                           {:name "extraction-schema" :content (cheshire.core/encode json-schema)}
                           {:name "multiple-extractions" :content "false"}
                           {:name "pdfs" :content (io/file file)}
                           
                           ]

               :as :json})

things stop working, when I set additionally the "Content-Type" header to "multipart/form-data", and I saw in client side logging, that no form data is send.
But this does not happen, when the base-url is "http://localhost:5000"

I checked this 10 times, and it does depend on 'which' base URL is used.... I am user Docker so, client code is the same remote and local,

So with base-url being localhost, It does work with and without setting the content type header,
when using "https:/....." it only works "without setting content-tpy header by hand".
(which is very strange, as I assume that it gets set automatically in any case by hato)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions