perwendel/spark — pull request #80 by littleli (2013-07-14 14:46:12+00:00)
Title: Content-Type should be modified only once, ie. in this case ignored by MatchingFilter

Reasoning:

Modifying content type (actually it's appending here) header causes terrible failure when accessing content for example by Firefox browser, which sends really weird Accept headers to access the content.

Request for Firefox looks like this:

Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8

...and response headers then contains multiple Content-Type lines even in case of explicit set by response.type("Content-Type", "text/html"):

Content-Type: text/html
Content-Type: */*

This is actually so much limiting, that it makes spark useless for this particular case. But of course, I understand the idea about matching accept header on request with matching response content type handle. So I wrote this very simple patch, which only tries to set content-type response header in case, where developer didn't specified some other type himself.

Firefox for example reacts on Content-Type: */*
by switchting to XML View of the markup. You can try yourself.