I'm doing the following:

setHeaderEx("Content-Type", "application/json", true)

According to the documentation, this should replace the contents of the Content-Type header. Although it does appear to replace the contents of that header, it adds a second Content-Type header. If I change the boolean to false, it still adds a second Content-Type header with application/json, but does not change the value of the original Content-Type header.

eg:

setHeaderEx("Content-Type", "application/json", true)

Content-Type: application/json
Content-Type: application/json

setHeaderEx("Content-Type", "application/json", false)

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

This confuses some clients and, rather obviously, it does not follow the HTML specification. I also noticed that if I do not match the case exactly, it behaves even worse:

setHeaderEx("content-type", "application/json", true)

Content-Type: text/html
content-type: application/json

setHeaderEx("content-type", "application/json", false)

Content-Type: text/html
content-type: application/json

I'm using Girder 6.0.19.1 for Windows.