File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -408,15 +408,21 @@ def handle_refresh(self, head_only=False):
408408 if not head_only :
409409 self .wfile .write (body )
410410 except FileNotFoundError :
411+ body = json .dumps ({"error" : "data.json not found" }).encode ()
411412 self .send_response (503 )
412413 self .send_header ("Content-Type" , "application/json" )
414+ self .send_header ("Content-Length" , str (len (body )))
413415 self .end_headers ()
414- self .wfile .write (json .dumps ({"error" : "data.json not found" }).encode ())
416+ if not head_only :
417+ self .wfile .write (body )
415418 except Exception as e :
419+ body = json .dumps ({"error" : str (e )}).encode ()
416420 self .send_response (500 )
417421 self .send_header ("Content-Type" , "application/json" )
422+ self .send_header ("Content-Length" , str (len (body )))
418423 self .end_headers ()
419- self .wfile .write (json .dumps ({"error" : str (e )}).encode ())
424+ if not head_only :
425+ self .wfile .write (body )
420426
421427 _MAX_BODY = 64 * 1024 # 64 KB request body limit
422428 _MAX_QUESTION = 2000 # max question length in chars
You can’t perform that action at this time.
0 commit comments