(error: unknown)
| 48 | * @param error the potential redirect error |
| 49 | */ |
| 50 | export function isRedirect(error: unknown): error is Redirect { |
| 51 | if (error == null || typeof error !== 'object') { |
| 52 | return false; |
| 53 | } |
| 54 | const hasValidLocation = 'location' in error && typeof error.location === 'string'; |
| 55 | const hasValidStatus = |
| 56 | 'status' in error && typeof error.status === 'number' && error.status >= 300 && error.status <= 308; |
| 57 | return hasValidLocation && hasValidStatus; |
| 58 | } |
| 59 | |
| 60 | /** |
| 61 | * Determines if a thrown "error" is a HttpError |
no outgoing calls
no test coverage detected