@@ -60,12 +60,49 @@ describe('Last Modified Utils Test', () => {
60
60
assert . strictEqual ( res . headers . get ( 'last-modified' ) , 'Wed, 12 Jan 2022 09:33:01 GMT' ) ;
61
61
} ) ;
62
62
63
+ it ( 'uses meta source-last-modified' , async ( ) => {
64
+ /** @type PipelineResponse */
65
+ const res = {
66
+ headers : new Map ( [
67
+ [ 'last-modified' , 'Wed, 12 Jan 2022 09:33:01 GMT' ] ,
68
+ [ 'x-amz-meta-x-source-last-modified' , 'Wed, 13 Jan 2022 09:33:01 GMT' ] ,
69
+ ] ) ,
70
+ } ;
71
+ const date = extractLastModified ( res . headers ) ;
72
+ assert . strictEqual ( date , 'Wed, 13 Jan 2022 09:33:01 GMT' ) ;
73
+ } ) ;
74
+
75
+ it ( 'uses meta last-modified' , async ( ) => {
76
+ /** @type PipelineResponse */
77
+ const res = {
78
+ headers : new Map ( [
79
+ [ 'last-modified' , 'Wed, 12 Jan 2022 09:33:01 GMT' ] ,
80
+ [ 'x-amz-meta-last-modified' , 'Wed, 13 Jan 2022 09:33:01 GMT' ] ,
81
+ ] ) ,
82
+ } ;
83
+ const date = extractLastModified ( res . headers ) ;
84
+ assert . strictEqual ( date , 'Wed, 13 Jan 2022 09:33:01 GMT' ) ;
85
+ } ) ;
86
+
63
87
it ( 'uses last-modified when meta source-last-modified is "null"' , async ( ) => {
88
+ /** @type PipelineResponse */
89
+ const res = {
90
+ headers : new Map ( [
91
+ [ 'last-modified' , 'Wed, 12 Jan 2022 09:33:01 GMT' ] ,
92
+ [ 'x-amz-meta-x-source-last-modified' , 'Wed, 12 Jan 2022 09:33:01 GMT' ] ,
93
+ ] ) ,
94
+ } ;
95
+ const date = extractLastModified ( res . headers ) ;
96
+ assert . strictEqual ( date , 'Wed, 12 Jan 2022 09:33:01 GMT' ) ;
97
+ } ) ;
98
+
99
+ it ( 'uses last-modified when meta last-modified is "null"' , async ( ) => {
64
100
/** @type PipelineResponse */
65
101
const res = {
66
102
headers : new Map ( [
67
103
[ 'last-modified' , 'Wed, 12 Jan 2022 09:33:01 GMT' ] ,
68
104
[ 'x-amz-meta-x-source-last-modified' , 'null' ] ,
105
+ [ 'x-amz-meta-last-modified' , 'null' ] ,
69
106
] ) ,
70
107
} ;
71
108
const date = extractLastModified ( res . headers ) ;
0 commit comments