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)
| 167 | * @return {undefined} - and call callback |
| 168 | */ |
| 169 | function 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 |
no test coverage detected