grantila / fetch-h2

HTTP/1+2 Fetch API client for Node.js
MIT License
336 stars 16 forks source link

Make Response constructor parameters optional #28

Closed niklaskorz closed 5 years ago

niklaskorz commented 5 years ago

According to the fetch spec, all parameters of the Response constructor are optional:

coveralls commented 5 years ago

Coverage Status

Coverage decreased (-0.06%) to 87.427% when pulling 2a1e1c3c4ec7ef1f87b4136d6f86d7cd6eb4b4e3 on niklaskorz:patch-1 into be4d3d1f3590056fa319f721e429e9ab94c30b0f on grantila:master.

niklaskorz commented 5 years ago

Also, I think status and statusText should be set to 200 per default? I'll see if I find something in that regard in the specs.

Edit: It's defined right in the spec, as

dictionary ResponseInit {
  unsigned short status = 200;
  ByteString statusText = "";
  HeadersInit headers;
};

I'll update the pull request accordingly.

grantila commented 5 years ago

Thanks! I've added the status(Text) defaults too, and released in 2.0.3