summaryrefslogtreecommitdiff
path: root/ext/fetch/20_headers.js
diff options
context:
space:
mode:
Diffstat (limited to 'ext/fetch/20_headers.js')
-rw-r--r--ext/fetch/20_headers.js17
1 files changed, 3 insertions, 14 deletions
diff --git a/ext/fetch/20_headers.js b/ext/fetch/20_headers.js
index 67c5d0e65..c35c745b5 100644
--- a/ext/fetch/20_headers.js
+++ b/ext/fetch/20_headers.js
@@ -15,12 +15,11 @@
const {
HTTP_TAB_OR_SPACE_PREFIX_RE,
HTTP_TAB_OR_SPACE_SUFFIX_RE,
- HTTP_WHITESPACE_PREFIX_RE,
- HTTP_WHITESPACE_SUFFIX_RE,
HTTP_TOKEN_CODE_POINT_RE,
byteLowerCase,
collectSequenceOfCodepoints,
collectHttpQuotedString,
+ httpTrim,
} = window.__bootstrap.infra;
const {
ArrayIsArray,
@@ -59,17 +58,7 @@
* @returns {string}
*/
function normalizeHeaderValue(potentialValue) {
- potentialValue = StringPrototypeReplaceAll(
- potentialValue,
- HTTP_WHITESPACE_PREFIX_RE,
- "",
- );
- potentialValue = StringPrototypeReplaceAll(
- potentialValue,
- HTTP_WHITESPACE_SUFFIX_RE,
- "",
- );
- return potentialValue;
+ return httpTrim(potentialValue);
}
/**
@@ -95,7 +84,7 @@
// Regex matching illegal chars in a header value
// deno-lint-ignore no-control-regex
- const ILLEGAL_VALUE_CHARS = /[\x00\x0A\x0D]/;
+ const ILLEGAL_VALUE_CHARS = /[\x00\x0A\x0D]/g;
/**
* https://fetch.spec.whatwg.org/#concept-headers-append