Skip to content
This repository was archived by the owner on Aug 24, 2022. It is now read-only.

Charset is not extracted from "Content-Type" header #70

Open
alexander-yakushev opened this issue Apr 12, 2018 · 1 comment
Open

Charset is not extracted from "Content-Type" header #70

alexander-yakushev opened this issue Apr 12, 2018 · 1 comment

Comments

@alexander-yakushev
Copy link

I pass a header content-type: application/json; charset=utf-8 in the HTTP request, but the lib ignores it and decides to instead infer the encoding which sometimes leads to :body becoming garbage.

I believe this function should do (get-in req [:headers "content-type"], not (get req :content-type). Or is there something else going on? In https://github.com/ngrunwald/ring-middleware-format/blob/master/src/ring/middleware/format_params.clj#L32

@Deraen
Copy link
Collaborator

Deraen commented Apr 15, 2018

Ring used to add content-type to the request map: https://github.com/ring-clojure/ring/blob/master/SPEC#L82

As it has been deprecated, maybe new Ring no longer does this?

Muuntaja reads request content-type first and then reads the header directly: https://github.com/metosin/muuntaja/blob/master/src/clj/muuntaja/core.clj#L124

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants