(statusText)
| 116 | // "reason-phrase = *( HTAB / SP / VCHAR / obs-text )" |
| 117 | // https://github.com/chromium/chromium/blob/94.0.4604.1/third_party/blink/renderer/core/fetch/response.cc#L116 |
| 118 | function isValidReasonPhrase (statusText) { |
| 119 | for (let i = 0; i < statusText.length; ++i) { |
| 120 | const c = statusText.charCodeAt(i) |
| 121 | if ( |
| 122 | !( |
| 123 | ( |
| 124 | c === 0x09 || // HTAB |
| 125 | (c >= 0x20 && c <= 0x7e) || // SP / VCHAR |
| 126 | (c >= 0x80 && c <= 0xff) |
| 127 | ) // obs-text |
| 128 | ) |
| 129 | ) { |
| 130 | return false |
| 131 | } |
| 132 | } |
| 133 | return true |
| 134 | } |
| 135 | |
| 136 | /** |
| 137 | * @see https://fetch.spec.whatwg.org/#header-name |
no outgoing calls
no test coverage detected