mongoose-cpp icon indicating copy to clipboard operation
mongoose-cpp copied to clipboard

Overriding header, doesn't override

Open Skeen opened this issue 10 years ago • 2 comments

When overriding the 'Content-Type' in a controller, by doing;

        response.setHeader("Content-Type", "application/json");

It doesn't actually override, it just appends another header to the response;

        Content-Length:23
        Content-Type:application/json
        Content-Type:text/html

The browser thereby interprets everything as html.

Skeen avatar Dec 31 '14 00:12 Skeen

Hello, This is maybe a case problem You define Content-Type and the default defined is Content-type (with a lowercase t)

Gregwar avatar Dec 31 '14 09:12 Gregwar

I've changed the default to Content-Type since this is more standard Can you confirm me it's ok? Maybe we could fix that, using map<string, pair<string, string> > with lowercase strings as keys for the map

Gregwar avatar Dec 31 '14 09:12 Gregwar