File tree 1 file changed +12
-2
lines changed 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -120,14 +120,24 @@ function extractResponseBody( response ) {
120
120
function createPaginationObject ( result , options , httpTransport ) {
121
121
let _paging = null ;
122
122
123
- if ( ! result . headers || ! result . headers [ 'x-wp-totalpages' ] ) {
123
+ if ( ! result . headers ) {
124
124
// No headers: return as-is
125
125
return _paging ;
126
126
}
127
127
128
+ // Guard against capitalization inconsistencies in returned headers
129
+ Object . keys ( result . headers ) . forEach ( ( header ) => {
130
+ result . headers [ header . toLowerCase ( ) ] = result . headers [ header ] ;
131
+ } ) ;
132
+
133
+ if ( ! result . headers [ 'x-wp-totalpages' ] ) {
134
+ // No paging: return as-is
135
+ return _paging ;
136
+ }
137
+
128
138
const totalPages = + result . headers [ 'x-wp-totalpages' ] ;
129
139
130
- if ( ! totalPages || totalPages === '0' ) {
140
+ if ( ! totalPages || totalPages === 0 ) {
131
141
// No paging: return as-is
132
142
return _paging ;
133
143
}
You can’t perform that action at this time.
0 commit comments