Bug 1397646 Comment 17 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

Actually, maybe it would be simplest to just change the base HTTP channel's GetResponseStatusText method (which of course XHRs and Fetch both check) instead? Something like this:

> NS_IMETHODIMP
> HttpBaseChannel::GetResponseStatusText(nsACString& aValue) {
>+  // http/2 should return an empty string
>+  nsAutoCString version;
>+  Unused << GetProtocolVersion(version);
>+  if (version.Equals("h2")) {
>+    aValue.Truncate();
>+    return NS_OK;
>+  }
>+
>   if (!mResponseHead) return NS_ERROR_NOT_AVAILABLE;
>   mResponseHead->StatusText(aValue);
>   return NS_OK;
> }

And also, since the web platform tests [aren't ready for this yet](https://github.com/web-platform-tests/wpt/issues/7274), I'm wondering whether it would be alright to add to netwerk/test/unit/test_http2.js, or if we should have separate tests for xhr and fetch?
Actually, maybe it would be simplest to just change the base HTTP channel's GetResponseStatusText method (which of course XHRs and Fetch both check) instead? Something like this:

```
 NS_IMETHODIMP
 HttpBaseChannel::GetResponseStatusText(nsACString& aValue) {
+  // http/2 should return an empty string
+  nsAutoCString version;
+  Unused << GetProtocolVersion(version);
+  if (version.Equals("h2")) {
+    aValue.Truncate();
+    return NS_OK;
+  }
+
   if (!mResponseHead) return NS_ERROR_NOT_AVAILABLE;
   mResponseHead->StatusText(aValue);
   return NS_OK;
 }
```

And also, since the web platform tests [aren't ready for this yet](https://github.com/web-platform-tests/wpt/issues/7274), I'm wondering whether it would be alright to add to netwerk/test/unit/test_http2.js, or if we should have separate tests for xhr and fetch?

Back to Bug 1397646 Comment 17