@@ -55,8 +55,12 @@ export function GlobalField (http, data = {}) {
5555 if ( this . apiVersion ) {
5656 delete this . stackHeaders . api_version
5757 }
58- if ( response . data ) {
59- return response . data
58+ const data = response . data
59+ if ( data ) {
60+ if ( this . stackHeaders ) {
61+ data . stackHeaders = this . stackHeaders
62+ }
63+ return data
6064 } else {
6165 throw error ( response )
6266 }
@@ -105,8 +109,12 @@ export function GlobalField (http, data = {}) {
105109 headers : { ...cloneDeep ( this . stackHeaders ) }
106110 }
107111 const response = await http . put ( `${ this . urlPath } ` , config , headers )
108- if ( response . data ) {
109- return response . data
112+ const data = response . data
113+ if ( data ) {
114+ if ( this . stackHeaders ) {
115+ data . stackHeaders = this . stackHeaders
116+ }
117+ return data
110118 } else {
111119 throw error ( response )
112120 }
@@ -146,8 +154,12 @@ export function GlobalField (http, data = {}) {
146154 if ( this . apiVersion ) {
147155 delete this . stackHeaders . api_version
148156 }
149- if ( response . data ) {
150- return response . data
157+ const data = response . data
158+ if ( data ) {
159+ if ( this . stackHeaders ) {
160+ data . stackHeaders = this . stackHeaders
161+ }
162+ return data
151163 } else {
152164 throw error ( response )
153165 }
@@ -183,8 +195,12 @@ export function GlobalField (http, data = {}) {
183195 }
184196 }
185197 const response = await http . get ( this . urlPath , headers )
186- if ( response . data ) {
187- return response . data
198+ const data = response . data
199+ if ( data ) {
200+ if ( this . stackHeaders ) {
201+ data . stackHeaders = this . stackHeaders
202+ }
203+ return data
188204 } else {
189205 throw error ( response )
190206 }
@@ -224,11 +240,16 @@ export function GlobalField (http, data = {}) {
224240 ...cloneDeep ( this . stackHeaders )
225241 }
226242 }
243+
227244 const response = await http . post ( `${ this . urlPath } ` , data , headers )
228- if ( response . data ) {
229- return response . data
245+ let data = response . data
246+ if ( data ) {
247+ if ( this . stackHeaders ) {
248+ data . stackHeaders = this . stackHeaders
249+ }
250+ return data
230251 } else {
231- return error ( response )
252+ throw error ( response )
232253 }
233254 } catch ( err ) {
234255 return error ( err )
0 commit comments