Skip to content
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

Validation interceptors #2

Open
kendarorg opened this issue Apr 3, 2015 · 3 comments
Open

Validation interceptors #2

kendarorg opened this issue Apr 3, 2015 · 3 comments

Comments

@kendarorg
Copy link

Hi, it would be nice to allow, parallel to the declaration of data, the declaration of a filter for each data block, to allow the simulation of validation errors and things like this:

restServer.initInterceptors({
    'customers': [
        { post: function(xhr,data,defaultHandler){
                       if(data.id < 0){
                              return {status:500,body:"WrongId"};
                      }
                      return defaultHandler(xhr,data)
        }}
    ]
});
@fzaninotto
Copy link
Member

Great idea! I'm not sure it should be an interceptor of a new method added to the server, but it'd definitely be useful.

@kendarorg
Copy link
Author

Hi Francois, i did a fork on github.com/kendarorg with a possible implementation (and updated readme...), it s only a proof of concept and i would need a deeper analisys. Btw after monday i ll manage to prepare a pull request with tests etc :)
Enrico

On April 3, 2015 5:32:09 PM GMT+02:00, Francois Zaninotto notifications@github.com wrote:

Great idea! I'm not sure it should be an interceptor of a new method
added to the server, but it'd definitely be useful.


Reply to this email directly or view it on GitHub:
#2 (comment)

Sent from my Android phone with K-9 Mail. Please excuse my brevity.

@djhi
Copy link
Contributor

djhi commented May 3, 2024

What do you think about modifying the request interceptors so that they could throw a response? RemixRun style

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants