Skip to content

Commit f68832b

Browse files
committed
revert namespace changes
1 parent 7b3d52b commit f68832b

File tree

2 files changed

+11
-17
lines changed

2 files changed

+11
-17
lines changed

src/endpoint/s3/s3_utils.js

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -666,22 +666,16 @@ function parse_body_logging_xml(req) {
666666
return logging;
667667
}
668668

669-
async function get_http_response_date(res, s3_client, bucket, key) {
670-
const r = await get_http_response_from_resp(res, s3_client, bucket, key);
671-
if (!r.LastModified) throw new Error("Date not found in response header");
672-
return r.LastModified;
673-
}
674-
675-
async function get_http_response_from_resp(res, s3_client, bucket, key) {
676-
const status_code = res.$metadata.httpStatusCode;
677-
if (status_code >= 300) throw new Error(`PutObject S3 request failed for bucket ${bucket}, Key: ${key} with status code :`, status_code);
678-
const head_res = await s3_client.headObject({
679-
Bucket: bucket,
680-
Key: key,
681-
});
682-
const head_status_code = res.$metadata.httpStatusCode;
683-
if (head_status_code >= 300) throw new Error(`headObject S3 request failed for bucket ${bucket}, Key: ${key} with status code :`, status_code);
684-
return head_res;
669+
function get_http_response_date(res) {
670+
const r = get_http_response_from_resp(res);
671+
if (!r.httpResponse.headers.date) throw new Error("date not found in response header");
672+
return r.httpResponse.headers.date;
673+
}
674+
675+
function get_http_response_from_resp(res) {
676+
const r = res.$response;
677+
if (!r) throw new Error("no $response in s3 returned object");
678+
return r;
685679
}
686680

687681
function get_response_field_encoder(req) {

src/util/http_utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,7 @@ function get_unsecured_agent(endpoint) {
472472
function _get_http_agent(endpoint, request_unsecured) {
473473
const { protocol, hostname } = url.parse(endpoint);
474474
const should_proxy_by_hostname = should_proxy(hostname);
475-
dbg.log0(`_get_http_agent: ` +
475+
dbg.log2(`_get_http_agent: ` +
476476
`endpoint ${endpoint} request_unsecured ${request_unsecured} ` +
477477
`protocol ${protocol} hostname ${hostname} should_proxy(hostname) ${should_proxy_by_hostname} ` +
478478
`Boolean(HTTPS_PROXY) ${Boolean(HTTPS_PROXY)} Boolean(HTTP_PROXY) ${Boolean(HTTP_PROXY)}`);

0 commit comments

Comments
 (0)