MCPcopy Create free account
hub / github.com/nodejs/node / isValidReasonPhrase

Function isValidReasonPhrase

deps/undici/src/lib/web/fetch/util.js:118–134  ·  view source on GitHub ↗
(statusText)

Source from the content-addressed store, hash-verified

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
118function 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

Callers 1

initializeResponseFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected