Closed Doogiemuc closed 5 years ago
A small workaround at least to distinguish between GET and other HTTP verbs is:
if (request.entity) { console.log("This is *not* a GET request, cause it has a body"); }
rest.js provides default values as late as possible. For the request method, the root client will provide a default. For most clients, like xhr and node, the default is a GET
unless there is an entity in which case the default is a POST
. This doesn't hold true for clients that don't support those methods, like the jsonp client which is fundamentally restricted to GET
.
The request method will be set on the request during the response phase.
export default interceptor({
response: function (response, config, meta) {
console.log(response.request.method); // should be set (unless there was no actual request)
}
});
rest.js is no longer maintained
More a question than an issue: I am writing a custom interceptor. Why is request.method empty during the request method of the interceptor.
I'd expect GET or POST?