-
Notifications
You must be signed in to change notification settings - Fork 194
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Customing FAILURE Response #189
Comments
You should be able to customize your "success" type descriptor with a function that returns an action of the desired Edit: forgot this only applies for the Another option would be to write a second middleware that can capture the "success" FSA, and modify it before sending to next middleware (based on payload) Maybe allowing the |
Thanks for the feedback.
That's what I was after. Can this ticket serves as feature request? or do you suggest that I create a separate ticket for it? |
Hi this is interesting. Feel free to open a PR or comment here with what you think this should look like.
#171 would allow you to pass in your own function to replace the default In your case I'd imagine the RSAA could look something like: {
[RSAA]: {
...
ok: async (res) => {
const json = await res.json();
return res.ok && !json.error;
}
...
}
} |
i think the suggestion by @nason could also work, without needing the second middleware, or changing the functionality of the Edit: nvm I'm dumb :) didn't also see that this can be configured per RSAA 👍 |
This functionality is in the 3.0 beta in the |
I'm getting the following error as action data while using RSAA.ok function
It seems that |
Is it possible to force an 'FAILURE' type base on the response data of a success API execution?
In a JSON-RPC API, all non-network errors should result in "HTTP Code 200" with error code and message in its payload. For example, response for an invalid request:
So my question is, is it possible to utlize RSAA and have custom success/failure rules oppose to fully relying on the response HTTP code?
The text was updated successfully, but these errors were encountered: