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

Escaped error message with regex validation #1508

Closed
kesla opened this issue Mar 23, 2014 · 3 comments
Closed

Escaped error message with regex validation #1508

kesla opened this issue Mar 23, 2014 · 3 comments
Assignees
Labels
bug Bug or defect
Milestone

Comments

@kesla
Copy link

kesla commented Mar 23, 2014

Similarly to #1012, the error messages when doing a validation with regex comes back escaped (and somewhat unreadable).

example:

{
    statusCode: 400,
    error: "Bad Request",
    message: "the value of foo must match the regular expression /^\d+$/",
    validation: {
        source: "path",
        keys: [
            "foo"
        ]
    }
}

Can this be improved somehow? Is there a way to set custom error messages (that would fix my use case)?

@hueniverse hueniverse added the bug label Mar 24, 2014
@dacbd
Copy link
Contributor

dacbd commented Mar 26, 2014

If you are still having this problem, in the short term you can use the onPreResponse extension point to edit the body of the response

link to the onPreResponse extension point in the request life cycle: documentation

@kesla
Copy link
Author

kesla commented Mar 27, 2014

@danielbarnes Thanks for the tip, I'm using that right

@hueniverse
Copy link
Contributor

The tricky part is to distinguish between insecure strings coming from the server and those coming from the client as bad input. I need to think about it.

@hueniverse hueniverse added this to the 5.0.1 milestone May 24, 2014
@hueniverse hueniverse self-assigned this May 24, 2014
@lock lock bot locked as resolved and limited conversation to collaborators Jan 12, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Bug or defect
Projects
None yet
Development

No branches or pull requests

3 participants