Skip to content

Commit

Permalink
isRedirectStatusCode: make parameter optional (#2812)
Browse files Browse the repository at this point in the history
  • Loading branch information
miherlosev committed Nov 7, 2022
1 parent 482a9e8 commit ee44f29
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/utils/is-redirect-status-code.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
const REDIRECT_STATUS_CODES = [301, 302, 303, 307, 308];

export default function (code: number): boolean {
export default function (code?: number): boolean {
if (!code)
return false;

return REDIRECT_STATUS_CODES.includes(code);
}
2 changes: 1 addition & 1 deletion ts-defs/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,7 @@ declare module 'testcafe-hammerhead' {
function getAssetPath(originPath: string, developmentMode: boolean): string;

/** Return whether the HTTP status code is a redirect status code **/
function isRedirectStatusCode (code: number): boolean;
function isRedirectStatusCode (code?: number): boolean;

/** **/
export class IncomingMessageLike {
Expand Down

0 comments on commit ee44f29

Please sign in to comment.