MCPcopy Index your code
hub / github.com/scality/cloudserver / _headersMatchRule

Function _headersMatchRule

lib/api/apiUtils/object/corsResponse.js:38–46  ·  view source on GitHub ↗

_headersMatchRule - check if headers match AllowedHeaders of rule * @param {string[]} headers - the value of the 'Access-Control-Request-Headers' * in an OPTIONS request * @param {string[]} allowedHeaders - AllowedHeaders of a CORS rule * @return {boolean} - true/false

(headers, allowedHeaders)

Source from the content-addressed store, hash-verified

36* @return {boolean} - true/false
37*/
38function _headersMatchRule(headers, allowedHeaders) {
39 if (!allowedHeaders) {
40 return false;
41 }
42 if (!headers.every(header => _matchesOneOf(allowedHeaders, header))) {
43 return false;
44 }
45 return true;
46}
47
48/** _findCorsRule - Return first matching rule in cors rules that permits
49* CORS request

Callers 1

findCorsRuleFunction · 0.85

Calls 1

_matchesOneOfFunction · 0.85

Tested by

no test coverage detected