Mercurial > p > roundup > code
diff test/test_liveserver.py @ 6509:1fc765ef6379
Fix 204 responses, hangs and crashes with REST.
Remove Content-Type and make sure no content is returned by OPTIONS
request in REST interface.
In write_html set the Content-Length when response is not
encoded/compressed (fixes hang due to missing content-length with
unencoded data).
In REST interface do not raise UsageError for invalid api version.
Return json error with proper message. Fixes crash.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Sat, 16 Oct 2021 13:34:04 -0400 |
| parents | 3d2c17be1d35 |
| children | c505c774a94d |
line wrap: on
line diff
--- a/test/test_liveserver.py Fri Oct 08 00:35:09 2021 -0400 +++ b/test/test_liveserver.py Sat Oct 16 13:34:04 2021 -0400 @@ -113,8 +113,7 @@ print(f.headers) self.assertEqual(f.status_code, 204) - expected = { 'Content-Type': 'application/json', - 'Access-Control-Allow-Origin': '*', + expected = { 'Access-Control-Allow-Origin': '*', 'Access-Control-Allow-Headers': 'Content-Type, Authorization, X-HTTP-Method-Override', 'Allow': 'OPTIONS, GET', 'Access-Control-Allow-Methods': 'HEAD, OPTIONS, GET, PUT, DELETE, PATCH', @@ -134,8 +133,7 @@ print(f.headers) self.assertEqual(f.status_code, 204) - expected = { 'Content-Type': 'application/json', - 'Access-Control-Allow-Origin': '*', + expected = { 'Access-Control-Allow-Origin': '*', 'Access-Control-Allow-Headers': 'Content-Type, Authorization, X-HTTP-Method-Override', 'Allow': 'OPTIONS, GET', 'Access-Control-Allow-Methods': 'HEAD, OPTIONS, GET, PUT, DELETE, PATCH', @@ -154,8 +152,7 @@ print(f.headers) self.assertEqual(f.status_code, 204) - expected = { 'Content-Type': 'application/json', - 'Access-Control-Allow-Origin': '*', + expected = { 'Access-Control-Allow-Origin': '*', 'Access-Control-Allow-Headers': 'Content-Type, Authorization, X-HTTP-Method-Override', 'Allow': 'OPTIONS, GET, POST', 'Access-Control-Allow-Methods': 'HEAD, OPTIONS, GET, PUT, DELETE, PATCH', @@ -175,8 +172,7 @@ print(f.headers) self.assertEqual(f.status_code, 204) - expected = { 'Content-Type': 'application/json', - 'Access-Control-Allow-Origin': '*', + expected = { 'Access-Control-Allow-Origin': '*', 'Access-Control-Allow-Headers': 'Content-Type, Authorization, X-HTTP-Method-Override', 'Allow': 'OPTIONS, GET, PUT, DELETE, PATCH', 'Access-Control-Allow-Methods': 'HEAD, OPTIONS, GET, PUT, DELETE, PATCH', @@ -195,8 +191,7 @@ print(f.headers) self.assertEqual(f.status_code, 204) - expected = { 'Content-Type': 'application/json', - 'Access-Control-Allow-Origin': '*', + expected = { 'Access-Control-Allow-Origin': '*', 'Access-Control-Allow-Headers': 'Content-Type, Authorization, X-HTTP-Method-Override', 'Allow': 'OPTIONS, GET, PUT, DELETE, PATCH', 'Access-Control-Allow-Methods': 'HEAD, OPTIONS, GET, PUT, DELETE, PATCH',
