@@ -84,7 +84,7 @@ export const create = ({ http, params }) => {
84
84
try {
85
85
const response = await http . post ( this . urlPath , data , headers )
86
86
if ( response . data ) {
87
- return new this . constructor ( http , parseData ( response , this . stackHeaders , this . content_type_uid , this . taxonomy_uid ) )
87
+ return new this . constructor ( http , parseData ( response , this . stackHeaders , this . content_type_uid , this . taxonomy_uid , http ) )
88
88
} else {
89
89
if ( response . status >= 200 && response . status < 300 ) {
90
90
return {
@@ -152,7 +152,7 @@ export const update = (http, type, params = {}) => {
152
152
}
153
153
} )
154
154
if ( response . data ) {
155
- return new this . constructor ( http , parseData ( response , this . stackHeaders , this . content_type_uid , this . taxonomy_uid ) )
155
+ return new this . constructor ( http , parseData ( response , this . stackHeaders , this . content_type_uid , this . taxonomy_uid , http ) )
156
156
} else {
157
157
throw error ( response )
158
158
}
@@ -211,7 +211,7 @@ export const fetch = (http, type, params = {}) => {
211
211
response . data [ type ] [ 'content_type' ] = response . data [ 'content_type' ]
212
212
response . data [ type ] [ 'schema' ] = response . data [ 'schema' ]
213
213
}
214
- return new this . constructor ( http , parseData ( response , this . stackHeaders , this . content_type_uid , this . taxonomy_uid ) )
214
+ return new this . constructor ( http , parseData ( response , this . stackHeaders , this . content_type_uid , this . taxonomy_uid , http ) )
215
215
} else {
216
216
throw error ( response )
217
217
}
@@ -242,7 +242,7 @@ export const fetchAll = (http, wrapperCollection, params = {}) => {
242
242
}
243
243
}
244
244
245
- export function parseData ( response , stackHeaders , contentTypeUID , taxonomy_uid ) {
245
+ export function parseData ( response , stackHeaders , contentTypeUID , taxonomy_uid , http ) {
246
246
const data = response . data || { }
247
247
if ( stackHeaders ) {
248
248
data . stackHeaders = stackHeaders
@@ -253,6 +253,12 @@ export function parseData (response, stackHeaders, contentTypeUID, taxonomy_uid)
253
253
if ( taxonomy_uid ) {
254
254
data . taxonomy_uid = taxonomy_uid
255
255
}
256
+ if ( http ?. httpClientParams ?. headers ?. includeResHeaders === true ) {
257
+ data . stackHeaders = {
258
+ ...data . stackHeaders ,
259
+ responseHeaders : response . headers ,
260
+ } ;
261
+ }
256
262
return data
257
263
}
258
264
@@ -300,7 +306,7 @@ export const move = (http, type, force = false, params = {}) => {
300
306
}
301
307
const response = await http . put ( `${ this . urlPath } /move` , updateData , headers )
302
308
if ( response . data ) {
303
- return new this . constructor ( http , parseData ( response , this . stackHeaders , this . content_type_uid , this . taxonomy_uid ) )
309
+ return new this . constructor ( http , parseData ( response , this . stackHeaders , this . content_type_uid , this . taxonomy_uid , http ) )
304
310
} else {
305
311
throw error ( response )
306
312
}
0 commit comments