(codeRange: string, code: number)
| 7 | * @param code the http status code to be checked against the code range |
| 8 | */ |
| 9 | export function isCodeInRange(codeRange: string, code: number): boolean { |
| 10 | // This is how the default value is encoded in OAG |
| 11 | if (codeRange === "0") { |
| 12 | return true; |
| 13 | } |
| 14 | if (codeRange == code.toString()) { |
| 15 | return true; |
| 16 | } else { |
| 17 | const codeString = code.toString(); |
| 18 | if (codeString.length != codeRange.length) { |
| 19 | return false; |
| 20 | } |
| 21 | for (let i = 0; i < codeString.length; i++) { |
| 22 | if (codeRange.charAt(i) != "X" && codeRange.charAt(i) != codeString.charAt(i)) { |
| 23 | return false; |
| 24 | } |
| 25 | } |
| 26 | return true; |
| 27 | } |
| 28 | } |
| 29 | |
| 30 | /** |
| 31 | * Returns if it can consume form |
no outgoing calls
no test coverage detected