@@ -666,22 +666,16 @@ function parse_body_logging_xml(req) {
666
666
return logging ;
667
667
}
668
668
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 ;
685
679
}
686
680
687
681
function get_response_field_encoder ( req ) {
0 commit comments