frontend/.pnpm-store/v3/files/d2/f7267452c6f97de66ebf4d72cbd1f850e552911be4f2e62f6cedd66962599ed6a0ea694f3a05553f634274c5fb5741fe3c6f45adca5e5856892042daf4dad3

12 lines
385 B
Plaintext

'use strict';
const {ERR_INVALID_HTTP_TOKEN} = require('./errors.js');
const isRequestPseudoHeader = require('./is-request-pseudo-header.js');
const isValidHttpToken = /^[\^`\-\w!#$%&*+.|~]+$/;
module.exports = name => {
if (typeof name !== 'string' || (!isValidHttpToken.test(name) && !isRequestPseudoHeader(name))) {
throw new ERR_INVALID_HTTP_TOKEN('Header name', name);
}
};