Also test for 204 - with empty reply

bug-non-200s-triggering
dgtlmoon 2 years ago
parent ec0f134e0e
commit e92dab5259

@ -58,7 +58,7 @@ def test_non_200_doesnt_trigger_change(client, live_server):
set_modified_response() set_modified_response()
# https://github.com/dgtlmoon/changedetection.io/issues/962#issuecomment-1416807742 # https://github.com/dgtlmoon/changedetection.io/issues/962#issuecomment-1416807742
for ecode in ['429', '400', '429', '403', '404', '500']: for ecode in ['429', '400', '204', '429', '403', '404', '500']:
with open("test-endpoint-status-code.txt", 'w') as f: with open("test-endpoint-status-code.txt", 'w') as f:
f.write(ecode) f.write(ecode)

@ -127,6 +127,8 @@ def live_server_setup(live_server):
# (Non-200 should get ignored) # (Non-200 should get ignored)
with open("test-datastore/endpoint-content.txt", "r") as f: with open("test-datastore/endpoint-content.txt", "r") as f:
contents ="{} code: {} ".format(f.read(), status_code) contents ="{} code: {} ".format(f.read(), status_code)
if status_code == '204':
contents=''
resp = make_response(contents, status_code) resp = make_response(contents, status_code)
resp.headers['Content-Type'] = 'text/html' resp.headers['Content-Type'] = 'text/html'
return resp, status_code return resp, status_code

Loading…
Cancel
Save