IIRC this has always been the behaviour of compojure: if you return a
string it wraps it into a minimalist, valid Ring map, but if you return a
map it assumes it is a Ring map and leaves it alone.

There is a content-type ring middleware somewhere on the web, though in
general I don't think the content type is something that can be magically
detected.

Any changes in your middlewares? The JSON middlewares in particular tend to
fill in the content type automatically (given a map for the body).


On Wednesday, 24 February 2016, Torsten Uhlmann <torsten.uhlm...@gmail.com>
wrote:

> Hi,
>
> I'm experiencing a strange behavior in my app. I'm not sure if that's
> because of a version update or something I broke...
>
> The Compojure version used is 1.4.0
>
> In the past a response like this would usually work:
>
> {:status 404
>  :headers {}
>  :body "Not authorized"}
>
>
> The map would be augmented with missing header information.
>
>
> Now the browser tells me this is an invalid response. Logging the output 
> shows that the map is returned as is, without any additional headers. Adding 
> "Content-Type" "text/html; charset=utf-8" to the :headers manually would 
> solve the problem.
>
>
> When my handler only returns a string, that is turned into a response map:
>
>
> {:status 200,
>  :headers {"Content-Type" "text/html; charset=utf-8"},
>  :body "hiha"}
>
>
> I'm using compojure's "route" function not the "defroutes" macro to assemble 
> route
>
>
> This is the development version middleware stack I'm using:
>
>
> (-> handler
>     (wrap-authorization auth-backend)
>     (wrap-authentication auth-backend)
>     ;(wrap-spy "SPY")
>     ext-session/wrap-extended-session
>     (wrap-defaults ring-defaults-config)
>     auth/wrap-authorized-redirects
>     wrap-exceptions
>     reload/wrap-reload
>     wrap-enlive-reload)
>
>
> I know I could solve this by adding the content type by hand, but I'd like to 
> get to the cause of this. I'd also like to just use response functions 
> provided by ring.util.response, these do also not work currently.
>
>
> I guess I just have misconfigured something- although I have no idea what.
>
>
> Torsten.
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> <javascript:_e(%7B%7D,'cvml','clojure@googlegroups.com');>
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> <javascript:_e(%7B%7D,'cvml','clojure%2bunsubscr...@googlegroups.com');>
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com
> <javascript:_e(%7B%7D,'cvml','clojure%2bunsubscr...@googlegroups.com');>.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to