Skip to content

Commit

Permalink
fix: Improved HEAD request fail test when fallback-ing to GET request (
Browse files Browse the repository at this point in the history
  • Loading branch information
Robloche committed Jan 8, 2024
1 parent 7f5005d commit b45877d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion lib/hls/hls_parser.js
Expand Up @@ -3771,7 +3771,9 @@ shaka.hls.HlsParser = class {

contentMimeType = response.headers['content-type'];
} catch (error) {
if (error && error.code == shaka.util.Error.Code.HTTP_ERROR) {
if (error &&
(error.code == shaka.util.Error.Code.HTTP_ERROR ||
error.code == shaka.util.Error.Code.BAD_HTTP_STATUS)) {
headRequest.method = 'GET';
const response = await this.makeNetworkRequest_(
headRequest, requestType, {type});
Expand Down
4 changes: 3 additions & 1 deletion lib/net/networking_utils.js
Expand Up @@ -37,7 +37,9 @@ shaka.net.NetworkingUtils = class {
const response = await netEngine.request(type, request).promise;
mimeType = response.headers['content-type'];
} catch (error) {
if (error && error.code == shaka.util.Error.Code.HTTP_ERROR) {
if (error &&
(error.code == shaka.util.Error.Code.HTTP_ERROR ||
error.code == shaka.util.Error.Code.BAD_HTTP_STATUS)) {
request.method = 'GET';
const response = await netEngine.request(type, request).promise;
mimeType = response.headers['content-type'];
Expand Down

0 comments on commit b45877d

Please sign in to comment.