Bug 1201632 - wptserve.py should send JSON failure message with correct mime type. r=jgraham
☠☠ backed out by 90f84f2af43e ☠ ☠
authorNikhil Marathe <nsm.nikhil@gmail.com>
Tue, 08 Sep 2015 16:05:43 -0700
changeset 294330 c1f58ad695a35d486078e30bbb362f999bb26366
parent 294329 2afc1965006352aa4213e02d745e3ac07a2fc5c2
child 294331 b892adb396017c491bd4c6d619a6567ca476e92b
push id5245
push userraliiev@mozilla.com
push dateThu, 29 Oct 2015 11:30:51 +0000
treeherdermozilla-beta@dac831dc1bd0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjgraham
bugs1201632
milestone43.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1201632 - wptserve.py should send JSON failure message with correct mime type. r=jgraham According to the JSON RFC [1] the official mime type is "application/json". If we do not send this, Gecko will not fire the onload event for a frame trying to load such a URL but will instead load an error page. Several service worker tests rely on loading 'fake' iframes that 404 but contribute to the progress of the test by watching for the onload event. These tests are fixed by this patch. [1]: http://www.ietf.org/rfc/rfc4627.txt
testing/web-platform/tests/tools/wptserve/wptserve/response.py
--- a/testing/web-platform/tests/tools/wptserve/wptserve/response.py
+++ b/testing/web-platform/tests/tools/wptserve/wptserve/response.py
@@ -204,17 +204,17 @@ class Response(object):
 
     def set_error(self, code, message=""):
         """Set the response status headers and body to indicate an
         error"""
         err = {"code": code,
                "message": message}
         data = json.dumps({"error": err})
         self.status = code
-        self.headers = [("Content-Type", "text/json"),
+        self.headers = [("Content-Type", "application/json"),
                         ("Content-Length", len(data))]
         self.content = data
         if code == 500:
             self.logger.error(message)
 
 
 class MultipartContent(object):
     def __init__(self, boundary=None, default_content_type=None):