MCPcopy
hub / github.com/scality/cloudserver / makeS3Request

Function makeS3Request

tests/functional/raw-node/utils/makeRequest.js:169–186  ·  view source on GitHub ↗

makeS3Request - utility function to generate a request against S3 * @param {object} params - params for making request * @param {string} params.method - request method * @param {object} [params.queryObj] - query fields and their string values * @param {object} [params.headers] - headers and thei

(params, callback)

Source from the content-addressed store, hash-verified

167 * @return {undefined} - and call callback
168 */
169function makeS3Request(params, callback) {
170 const { method, queryObj, headers, bucket, objectKey, authCredentials, requestBody }
171 = params;
172 const options = {
173 authCredentials,
174 hostname: process.env.AWS_ON_AIR ? 's3.amazonaws.com' : ipAddress,
175 port: process.env.AWS_ON_AIR ? 80 : 8000,
176 method,
177 queryObj,
178 headers: headers || {},
179 path: bucket ? `/${bucket}/` : '/',
180 requestBody,
181 };
182 if (objectKey) {
183 options.path = `${options.path}${objectKey}`;
184 }
185 makeRequest(options, callback);
186}
187
188/** makeBackbeatRequest - utility function to generate a request going
189 * through backbeat route

Callers 6

headObject.jsFile · 0.85
lifecycle.jsFile · 0.85

Calls 1

makeRequestFunction · 0.70

Tested by

no test coverage detected