Unable to build Response object with status code 204

Fixed Issue #12821885


Chris M.
Jul 18, 2017
This issue is public.
Found in
  • Microsoft Edge
Standard affected
Fetch Standard

Found in build #
Fixed in build #
Reported by 1 person

Sign in to watch or report this issue.

Steps to reproduce

To reproduce simply execute the following commands via the console

var respHeaders = new Headers();
respHeaders.append('Content-Type', 'application/json');
var response = new Response(null, { headers: respHeaders, status: 204, statusText: 'No Content' });

After executing the final command you will receive the following error:

Failed to construct 'Response’: A response with a null HTTP status code cannot have a body.

This works in chrome and firefox as you can have an empty body with a response code 204.

I’m building a custom Response object to unit test my code.

Standard refs:



0 attachments

    Comments and activity

    • This also fails with the following:

      var response = new Response(undefined, { headers: respHeaders, status: 204, statusText: 'No Content' });
    • Firefox requires the use of undefined while Chrome supports the use of null or undefined

    • Microsoft Edge Team

      Changed Assigned To to “Steven K.”

      Changed Assigned To to “Venkat K.”

      Changed Assigned To from “Venkat K.” to “Divya G.”

      Changed Status to “Fixed”

    • Thank you for addressing this issue. How do I find out what version of Edge this fix will be included in? Forgive me if I’m asking too soon. First time logging a ticket for Edge.

    • Hello,

      Thank you for providing this information about the issue. We are pleased to report this feature is fixed in Edge and will be available in an upcoming Insider Preview build.

      Best Wishes,
      The MS Edge Team

    • Hello, i’m now on fall creators update and am wonder if i should expect this to be fixed in that build? I’m getting different behavior now and am wondering if it’s a side effect of another change or this is the intended new behavior that came from this fix.



    • The behavior now is that can no longer reproduce via the console when using "null". I get a permissions error when i use "undefined". But i can still reproduce when i run my unit tests which do use “null”

    • Please look at following peace of code.
      LogResponse function is not getting called when http status code is 204.

      function logResponse(responseDetails) {
        {urls: [target]});    
        {urls: [target]};  
    • Ignore my last comment. Unit tests and console work just fine when using null. According to the fetch spec, null is expected rather than undefined.

      Fixed in 41.16299.15.0

      Cheers and thanks!

    You need to sign in to your Microsoft account to add a comment.

    Sign in