Unable to build Response object with status code 204

Fixed, not yet flighted Issue #12821885

Details

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

Found in build #
15.15063
Reports
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:

https://fetch.spec.whatwg.org/#concept-response
https://fetch.spec.whatwg.org/#concept-status

Attachments

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

    • Microsoft Edge Team

      Changed Status from “Fixed” to “Fixed, not yet flighted”

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

    Sign in