Convert headers to string for Flask Response

Same situation as in #13, but with the headers returned when there is an
exception, eg malformed JSON.