Skip to content
This repository has been archived by the owner on Oct 3, 2020. It is now read-only.

Commit

Permalink
Fixing an issue from the ARC where the status text of the response ca…
Browse files Browse the repository at this point in the history
…used an error when constructing the response from the UTF-8 string. The response object accepts the status text as a ByteString (https://bugs.chromium.org/p/chromium/issues/detail?id=680965)
  • Loading branch information
arcauto committed Jan 20, 2017
1 parent fa53db5 commit 1078da7
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions app.response.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,13 @@ class ArcResponse {
if (body === null) {
body = '';
}

if (init.statusText) {
// see: https://github.com/jarrodek/ChromeRestClient/issues/419#issuecomment-271532029
let encoder = new TextEncoder();
let bytes = encoder.encode(init.statusText);
init.statusText = String.fromCharCode.apply(null, bytes);
}
this._response = new Response(body, init);
this.rawResponse = body;
}
Expand Down

0 comments on commit 1078da7

Please sign in to comment.