MCPcopy Create free account
hub / github.com/scality/cloudserver / hasCorsHeaders

Function hasCorsHeaders

lib/api/api.js:103–114  ·  view source on GitHub ↗
(callbackArgs)

Source from the content-addressed store, hash-verified

101// corsHeaders), (err, dataGetInfo, resMetaHeaders, range), ...) so we
102// scan the args instead of relying on a fixed position.
103function hasCorsHeaders(callbackArgs) {
104 for (const arg of callbackArgs) {
105 if (!arg || typeof arg !== 'object' || Array.isArray(arg)
106 || Buffer.isBuffer(arg)) {
107 continue;
108 }
109 if ('access-control-allow-origin' in arg) {
110 return true;
111 }
112 }
113 return false;
114}
115
116// Wrap the API callback so that, on error, we look up the bucket's CORS
117// configuration and set the matching Access-Control-* headers directly on

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected