'If the CGI script emits a I{content-type} header, make sure that the
server doesn\'t add an additional (duplicate) one, as per ticket 4786.'

def test_noDuplicateContentTypeHeaders(self):

    cgiFilename = self.writeCGI(NO_DUPLICATE_CONTENT_TYPE_HEADER_CGI)
    portnum = self.startServer(cgiFilename)
    url = ('http://localhost:%d/cgi' % (portnum,))
    url = url.encode('ascii')
    agent = client.Agent(reactor)
    d = agent.request('GET', url)
    d.addCallback(discardBody)
    def checkResponse(response):
        self.assertEqual(response.headers.getRawHeaders('content-type'), ['text/cgi-duplicate-test'])
        return response
    d.addCallback(checkResponse)
    return d
