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

Function bucketHead

lib/api/bucketHead.js:16–42  ·  view source on GitHub ↗

* Determine if bucket exists and if user has permission to access it * @param {AuthInfo} authInfo - Instance of AuthInfo class with requester's info * @param {object} request - http request object * @param {object} log - Werelogs logger * @param {function} callback - callback to respond to http

(authInfo, request, log, callback)

Source from the content-addressed store, hash-verified

14 * @return {undefined}
15 */
16function bucketHead(authInfo, request, log, callback) {
17 log.debug('processing request', { method: 'bucketHead' });
18 const bucketName = request.bucketName;
19 const metadataValParams = {
20 authInfo,
21 bucketName,
22 requestType: request.apiMethods || 'bucketHead',
23 request,
24 };
25 standardMetadataValidateBucket(metadataValParams, request.actionImplicitDenies, log, (err, bucket) => {
26 const corsHeaders = collectCorsHeaders(request.headers.origin,
27 request.method, bucket);
28 if (err) {
29 monitoring.promMetrics(
30 'HEAD', bucketName, err.code, 'headBucket');
31 return callback(err, corsHeaders);
32 }
33 pushMetric('headBucket', log, {
34 authInfo,
35 bucket: bucketName,
36 });
37 const headers = {
38 'x-amz-bucket-region': bucket.getLocationConstraint(),
39 };
40 return callback(null, Object.assign(corsHeaders, headers));
41 });
42}
43
44module.exports = bucketHead;

Callers 3

bucketHead.jsFile · 0.85
transientBucket.jsFile · 0.85

Calls 5

collectCorsHeadersFunction · 0.85
pushMetricFunction · 0.85
debugMethod · 0.80
getLocationConstraintMethod · 0.80

Tested by

no test coverage detected