Closed ycdesu closed 9 years ago
Hi @ycavatars, the HttpStateSource uses the isomorphic-fetch polyfill for making the request. When you make a call to this.request
it calls the fetch API and then handles the response for you (see code here). If the server responds with status 400 or greater, Marty will throw the response as an exception. Otherwise it will resolve normally. Therefore you can do the following:
this.request({ method: "patch" ...})
.then(function (res) {
console.log("everything went better than expected!");
})
.catch(function (res) {
console.log("something foobar'd");
});
Does that help?
yes, really thanks :)
I'll do a quick PR for you to add in the PATCH method as a sugar function like the other methods.
hello, I read
http.js
and found that it doesn't support PATCH method. I try to callthis.request
with option{method: "patch" ...}
to send a PATCH request. The problem is, I don't know how to handle the promise rejection if an error occurred. Could you tell me where can I get enough information to achieve this? thanks.