Skip to content

Commit

Permalink
feat: Add response URI to BAD_HTTP_STATUS error (#6561)
Browse files Browse the repository at this point in the history
Closes #2969
  • Loading branch information
avelad committed May 8, 2024
1 parent 309d7d4 commit ed93987
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
3 changes: 2 additions & 1 deletion lib/net/http_plugin_utils.js
Expand Up @@ -58,7 +58,8 @@ shaka.net.HttpPluginUtils = class {
status,
responseText,
headers,
requestType);
requestType,
responseURL || uri);
}
}
};
2 changes: 2 additions & 0 deletions lib/util/error.js
Expand Up @@ -212,6 +212,8 @@ shaka.util.Error.Code = {
* <br> error.data[3] is the map of response headers.
* <br> error.data[4] is the NetworkingEngine.RequestType of the request,
* if one was provided.
* <br> error.data[5] is the final URI. This may be different if the initial
* URI (error.data[0]) issued a redirect.
*/
'BAD_HTTP_STATUS': 1001,

Expand Down
8 changes: 4 additions & 4 deletions test/net/http_plugin_unit.js
Expand Up @@ -227,7 +227,7 @@ function httpPluginTests(usingFetch) {
shaka.util.Error.Severity.RECOVERABLE,
shaka.util.Error.Category.NETWORK,
shaka.util.Error.Code.BAD_HTTP_STATUS,
uri, 202, '', jasmine.any(Object), requestType);
uri, 202, '', jasmine.any(Object), requestType, uri);
await testFails(uri, expected);
});

Expand All @@ -237,7 +237,7 @@ function httpPluginTests(usingFetch) {
shaka.util.Error.Severity.CRITICAL,
shaka.util.Error.Category.NETWORK,
shaka.util.Error.Code.BAD_HTTP_STATUS,
uri, 401, '', jasmine.any(Object), requestType);
uri, 401, '', jasmine.any(Object), requestType, uri);
await testFails(uri, expected);
});

Expand All @@ -247,7 +247,7 @@ function httpPluginTests(usingFetch) {
shaka.util.Error.Severity.CRITICAL,
shaka.util.Error.Category.NETWORK,
shaka.util.Error.Code.BAD_HTTP_STATUS,
uri, 403, '', jasmine.any(Object), requestType);
uri, 403, '', jasmine.any(Object), requestType, uri);
await testFails(uri, expected);
});

Expand All @@ -257,7 +257,7 @@ function httpPluginTests(usingFetch) {
shaka.util.Error.Severity.RECOVERABLE,
shaka.util.Error.Category.NETWORK,
shaka.util.Error.Code.BAD_HTTP_STATUS,
uri, 404, 'ABC', {'foo': 'BAR'}, requestType);
uri, 404, 'ABC', {'foo': 'BAR'}, requestType, uri);
await testFails(uri, expected);
});

Expand Down

0 comments on commit ed93987

Please sign in to comment.