(callbackArgs)
| 101 | // corsHeaders), (err, dataGetInfo, resMetaHeaders, range), ...) so we |
| 102 | // scan the args instead of relying on a fixed position. |
| 103 | function 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 |
no outgoing calls
no test coverage detected