yada icon indicating copy to clipboard operation
yada copied to clipboard

Content-Type header may not be set if no Accept header in the request

Open malcolmsparks opened this issue 8 years ago • 1 comments

I think it might be a bug in yada where if you don't send an Accept header (which implies ​/​), the Content-Type isn't set

malcolmsparks avatar May 06 '16 11:05 malcolmsparks

I just hit this (or a similar issue?) on a PUT route. I'm not sure exactly what is required for this, but Leiningen's headers that it sends when deploying are:

{"host" "localhost:3000",
   "user-agent"
   "Leiningen/2.7.0 (Java Java HotSpot(TM) 64-Bit Server VM; Mac OS X 10.12.4; x86_64)",
   "content-length" "2672",
   "connection" "Keep-Alive",
   "pragma" "no-cache",
   "expires" "0",
   "authorization" "Basic <base64 pass>",
   "accept-encoding" "gzip",
   "cache-store" "no-store",
   "cache-control" "no-cache"},

which aren't enough to populate a content-type, so content-type is nil which leads to this exception:

:error #error {
 :cause "Unsupported Media Type"
 :data {
    :status 415, 
    :message "Method does not declare that it consumes this content-type", 
    :consumes #{"*/*" "application/java-archive" "application/x-www-form-urlencoded" "text/xml" "text/plain"}, 
    :content-type nil}

danielcompton avatar Apr 10 '17 00:04 danielcompton