StatusCodeMatches returns true if a real HTTP status code matches the configured status code, which may be either a real HTTP status code or an integer representing a class of codes (e.g. 4 for all 4xx statuses).
(actual, configured int)
| 228 | // code or an integer representing a class of codes (e.g. 4 for all |
| 229 | // 4xx statuses). |
| 230 | func StatusCodeMatches(actual, configured int) bool { |
| 231 | if actual == configured { |
| 232 | return true |
| 233 | } |
| 234 | if configured < 100 && |
| 235 | actual >= configured*100 && |
| 236 | actual < (configured+1)*100 { |
| 237 | return true |
| 238 | } |
| 239 | return false |
| 240 | } |
| 241 | |
| 242 | // SanitizedPathJoin performs filepath.Join(root, reqPath) that |
| 243 | // is safe against directory traversal attacks. It uses logic |
no outgoing calls
no test coverage detected