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

Function parseExtensions

deps/undici/src/lib/web/websocket/util.js:204–221  ·  view source on GitHub ↗
(extensions)

Source from the content-addressed store, hash-verified

202 */
203// TODO(@Uzlopak, @KhafraDev): make compliant https://datatracker.ietf.org/doc/html/rfc6455#section-9.1
204function parseExtensions (extensions) {
205 const position = { position: 0 }
206 const extensionList = new Map()
207
208 while (position.position < extensions.length) {
209 const pair = collectASequenceOfCodePointsFast(';', extensions, position)
210 const [name, value = ''] = pair.split('=', 2)
211
212 extensionList.set(
213 removeHTTPWhitespace(name, true, false),
214 removeHTTPWhitespace(value, false, true)
215 )
216
217 position.position++
218 }
219
220 return extensionList
221}
222
223/**
224 * @see https://www.rfc-editor.org/rfc/rfc7692#section-7.1.2.2

Callers 1

processResponseFunction · 0.70

Calls 4

removeHTTPWhitespaceFunction · 0.50
splitMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected