rest - Vue-resource can't get response body when HTTP error 500 -
i'm trying handle http 500 error using vue-resource (1.2.1) way:
const resource = vue.resource('items');  resource.get().then(   (response) => {     // response.body   },   (error) => {     // error.body,     // if http status code 500.     // it's null...   } ); there nothing in error.body, while actual server's response have say... , want data displayed in cool way app's users aware of what's going on (rather opening dev tools , inspect network's response data).
is there i'm missing in vue http config? or maybe server-side, api needs respond in specific way? or respond special headers? or, limitation (or bug) of vue-resource?
edit
 here content of error, picked console.log:
response {     body: "",     bodytext: "",     headers: headers…,     ok: false,     status: 0,     statustext: "",     url: "http://my.domain/items",     data: "" } and, content of actual server response (which expected error.body, not), picked "network" tab in dev tools :
{     "success": false,     "error": {         "message":"this error message",         "details":[],         "stacktrace":[]     } }  
 
  
Comments
Post a Comment