Injection error

I am trying to test some proof of concept software that utilizes mitmproxy. It is attempting to inject some javascript code into the browser, but is generating the following error; clientconnect clientconnect
Script error: Traceback (most recent call last):
File “”, line 13, in response
File “/root/.local/lib/python3.6/site-packages/mitmproxy/types/”, line 39, in getitem
raise KeyError(key)
KeyError: ‘content-type’


Hi @tremmert,

Your response does not have a Content-Type header, so flow.response.headers[“content-type”] fails with a KeyError. That’s similar to x = {}; x["foo"]. You need to either check for existence or use .get. :slight_smile: