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

Function getResponseHeader

lib/routes/veeam/utils.js:90–106  ·  view source on GitHub ↗

* Get response headers for the object * @param {object} request - incoming request * @param {BucketInfo} bucket - bucket * @param {string} dataBuffer - data to send as a buffer * @param {date} [lastModified] - last modified date of the value * @param {object} log - logging object * @returns {o

(request, bucket, dataBuffer, lastModified, log)

Source from the content-addressed store, hash-verified

88 * @returns {object} - response headers
89 */
90function getResponseHeader(request, bucket, dataBuffer, lastModified, log) {
91 const corsHeaders = collectCorsHeaders(request.headers.origin,
92 request.method, bucket);
93 const responseMetaHeaders = collectResponseHeaders({
94 'last-modified': lastModified || new Date().toISOString(),
95 'content-md5': crypto
96 .createHash('md5')
97 .update(dataBuffer)
98 .digest('hex'),
99 'content-length': dataBuffer.byteLength,
100 'content-type': 'text/xml',
101 }, corsHeaders, null, false);
102 responseMetaHeaders.versionId = 'null';
103 responseMetaHeaders['x-amz-id-2'] = log.getSerializedUids();
104 responseMetaHeaders['x-amz-request-id'] = log.getSerializedUids();
105 return responseMetaHeaders;
106}
107/**
108 * Builds a headless XML string wrapped in the standard SOSAPI XML declaration.
109 *

Callers 3

headVeeamFileFunction · 0.85
listVeeamFilesFunction · 0.85
respondWithDataFunction · 0.85

Calls 3

collectCorsHeadersFunction · 0.85
collectResponseHeadersFunction · 0.85
getSerializedUidsMethod · 0.80

Tested by

no test coverage detected