@@ -84,7 +84,7 @@ export const create = ({ http, params }) => {
8484 try {
8585 const response = await http . post ( this . urlPath , data , headers )
8686 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 ) )
8888 } else {
8989 if ( response . status >= 200 && response . status < 300 ) {
9090 return {
@@ -152,7 +152,7 @@ export const update = (http, type, params = {}) => {
152152 }
153153 } )
154154 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 ) )
156156 } else {
157157 throw error ( response )
158158 }
@@ -211,7 +211,7 @@ export const fetch = (http, type, params = {}) => {
211211 response . data [ type ] [ 'content_type' ] = response . data [ 'content_type' ]
212212 response . data [ type ] [ 'schema' ] = response . data [ 'schema' ]
213213 }
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 ) )
215215 } else {
216216 throw error ( response )
217217 }
@@ -242,7 +242,7 @@ export const fetchAll = (http, wrapperCollection, params = {}) => {
242242 }
243243}
244244
245- export function parseData ( response , stackHeaders , contentTypeUID , taxonomy_uid ) {
245+ export function parseData ( response , stackHeaders , contentTypeUID , taxonomy_uid , http ) {
246246 const data = response . data || { }
247247 if ( stackHeaders ) {
248248 data . stackHeaders = stackHeaders
@@ -253,6 +253,12 @@ export function parseData (response, stackHeaders, contentTypeUID, taxonomy_uid)
253253 if ( taxonomy_uid ) {
254254 data . taxonomy_uid = taxonomy_uid
255255 }
256+ if ( http ?. httpClientParams ?. headers ?. includeResHeaders === true ) {
257+ data . stackHeaders = {
258+ ...data . stackHeaders ,
259+ responseHeaders : response . headers ,
260+ } ;
261+ }
256262 return data
257263}
258264
@@ -300,7 +306,7 @@ export const move = (http, type, force = false, params = {}) => {
300306 }
301307 const response = await http . put ( `${ this . urlPath } /move` , updateData , headers )
302308 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 ) )
304310 } else {
305311 throw error ( response )
306312 }
0 commit comments