在调试代码过程中,发现 一个报错:Object of type ‘CaseInsensitiveDict‘ is not JSON serializable
<class 'dict'>
{'R': '{"a": "111", "b": {"c": [1, 123], "d": "01"}}',
'RD': "\n[status_code]:200\n\n[header]:{'Date': 'Mon, 24 Oct 2022 13:35:42 GMT', 'Server': 'WSGIServer/0.2 CPython/3.6.8', 'Content-Type': 'application/json', 'Content-Length': '44', 'Vary': 'Origin', 'X-Content-Type-Options': 'nosniff', 'Referrer-Policy': 'same-origin'}\n",
'CR': '【新配置】 = False',
'TQ': {},
'REPORT': {'label': 'dlz', 'result': False, 'method': 'get', 'url': 'http://localhost:8000/test_a/?', 'request_headers': {}, 'payload_method': 'x-www-form-urlencode', 'payload_raw_method': '', 'payload': '{"payload_fd": [{"key": "ddd", "value": "777", "des": "\\u6d4b\\u8bd5"}], "payload_xwfu": [], "payload_raw": "", "payload_GQL_q": "333", "payload_GQL_g": "444"}', 'status_code': 200, 'response_header': {'Date': 'Mon, 24 Oct 2022 13:35:42 GMT', 'Server': 'WSGIServer/0.2 CPython/3.6.8', 'Content-Type': 'application/json', 'Content-Length': '44', 'Vary': 'Origin', 'X-Content-Type-Options': 'nosniff', 'Referrer-Policy': 'same-origin'},
'R': '{"a": "111", "b": {"c": [1, 123], "d": "01"}}',
'CR': '【新配置】 = False',
'TQ': {}}
}
{'R': '{"a": "111", "b": {"c": [1, 123], "d": "01"}}',
'RD': "\n[status_code]:200\n\n[header]:{'Date': 'Mon, 24 Oct 2022 13:35:42 GMT', 'Server': 'WSGIServer/0.2 CPython/3.6.8', 'Content-Type': 'application/json', 'Content-Length': '44', 'Vary': 'Origin', 'X-Content-Type-Options': 'nosniff', 'Referrer-Policy': 'same-origin'}\n",
'CR': '【新配置】 = False',
'TQ': {},
'REPORT': {'label': 'dlz', 'result': False, 'method': 'get', 'url': 'http://localhost:8000/test_a/?', 'request_headers': {}, 'payload_method': 'x-www-form-urlencode', 'payload_raw_method': '', 'payload': '{"payload_fd": [{"key": "ddd", "value": "777", "des": "\\u6d4b\\u8bd5"}], "payload_xwfu": [], "payload_raw": "", "payload_GQL_q": "333", "payload_GQL_g": "444"}', 'status_code': 200, 'response_header': {'Date': 'Mon, 24 Oct 2022 13:35:42 GMT', 'Server': 'WSGIServer/0.2 CPython/3.6.8', 'Content-Type': 'application/json', 'Content-Length': '44', 'Vary': 'Origin', 'X-Content-Type-Options': 'nosniff', 'Referrer-Policy': 'same-origin'},
'R': '{"a": "111", "b": {"c": [1, 123], "d": "01"}}',
'CR': '【新配置】 = False',
'TQ': {}}
}
经过排查发现,原来是红色部分的value值不是字符串格式,将红色部分转换成string格式即可