@@ -197,9 +197,14 @@ const RESTController = {
197197 } else if ( status >= 400 && status < 500 ) {
198198 const error = await response . json ( ) ;
199199 promise . reject ( error ) ;
200- } else if ( status === 301 || status === 302 || status === 303 || status === 307 ) {
200+ } else if ( [ 301 , 302 , 303 , 307 , 308 ] . includes ( status ) ) {
201201 const location = response . headers . get ( 'location' ) ;
202- promise . resolve ( { status, location, method : status === 303 ? 'GET' : method } ) ;
202+ promise . resolve ( {
203+ status,
204+ location,
205+ method : status === 303 ? 'GET' : method ,
206+ body : status === 303 ? null : data ,
207+ } ) ;
203208 } else if ( status >= 500 || status === 0 ) {
204209 // retry on 5XX or library error
205210 if ( ++ attempts < CoreManager . get ( 'REQUEST_ATTEMPT_LIMIT' ) ) {
@@ -311,7 +316,7 @@ const RESTController = {
311316 return RESTController . ajax ( method , url , payloadString , { } , options ) . then ( async ( result ) => {
312317 if ( result . location ) {
313318 const newURL = getPath ( result . location , path ) ;
314- result = await RESTController . ajax ( result . method , newURL , payloadString , { } , options ) ;
319+ result = await RESTController . ajax ( result . method , newURL , result . body , { } , options ) ;
315320 }
316321 const { response, status, headers } = result ;
317322 if ( options . returnStatus ) {
0 commit comments