(request, log, cb)
| 82 | */ |
| 83 | |
| 84 | function _parseXML(request, log, cb) { |
| 85 | if (request.post) { |
| 86 | return parseString(request.post, (err, result) => { |
| 87 | if (err || !result.CreateBucketConfiguration |
| 88 | || !result.CreateBucketConfiguration.LocationConstraint |
| 89 | || !result.CreateBucketConfiguration.LocationConstraint[0]) { |
| 90 | log.debug('request xml is malformed'); |
| 91 | return cb(errors.MalformedXML); |
| 92 | } |
| 93 | const locationConstraint = result.CreateBucketConfiguration |
| 94 | .LocationConstraint[0]; |
| 95 | log.trace('location constraint', |
| 96 | { locationConstraint }); |
| 97 | const locationCheck = checkLocationConstraint(request, |
| 98 | locationConstraint, log); |
| 99 | if (locationCheck.error) { |
| 100 | return cb(locationCheck.error); |
| 101 | } |
| 102 | return cb(null, locationCheck.locationConstraint); |
| 103 | }); |
| 104 | } |
| 105 | return process.nextTick(() => { |
| 106 | const locationCheck = checkLocationConstraint(request, |
| 107 | undefined, log); |
| 108 | if (locationCheck.error) { |
| 109 | return cb(locationCheck.error); |
| 110 | } |
| 111 | return cb(null, locationCheck.locationConstraint); |
| 112 | }); |
| 113 | } |
| 114 | |
| 115 | function _buildConstantParams({ |
| 116 | request, bucketName, authInfo, authParams, ip, isSecure, locationConstraint, apiMethod }) { |
no test coverage detected