MCPcopy Index your code
hub / github.com/nodejs/node / collectAnHTTPQuotedString

Function collectAnHTTPQuotedString

deps/undici/undici.js:4534–4566  ·  view source on GitHub ↗
(input, position, extractValue = false)

Source from the content-addressed store, hash-verified

4532 }
4533 __name(parseMIMEType, "parseMIMEType");
4534 function collectAnHTTPQuotedString(input, position, extractValue = false) {
4535 const positionStart = position.position;
4536 let value = "";
4537 assert(input[position.position] === '"');
4538 position.position++;
4539 while (true) {
4540 value += collectASequenceOfCodePoints(
4541 (char) => char !== '"' && char !== "\\",
4542 input,
4543 position
4544 );
4545 if (position.position >= input.length) {
4546 break;
4547 }
4548 const quoteOrBackslash = input[position.position];
4549 position.position++;
4550 if (quoteOrBackslash === "\\") {
4551 if (position.position >= input.length) {
4552 value += "\\";
4553 break;
4554 }
4555 value += input[position.position];
4556 position.position++;
4557 } else {
4558 assert(quoteOrBackslash === '"');
4559 break;
4560 }
4561 }
4562 if (extractValue) {
4563 return value;
4564 }
4565 return input.slice(positionStart, position.position);
4566 }
4567 __name(collectAnHTTPQuotedString, "collectAnHTTPQuotedString");
4568 function serializeAMimeType(mimeType) {
4569 assert(mimeType !== "failure");

Callers 2

parseMIMETypeFunction · 0.70
gettingDecodingSplittingFunction · 0.70

Calls 3

sliceMethod · 0.65
assertFunction · 0.50

Tested by

no test coverage detected