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

Add ability to customize response in case of error by passing callable object #15

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

ysv
Copy link

@ysv ysv commented Oct 17, 2019

We are willing to use your gem in our stack but faced one limitation.
It's impossible to customize error messages because they are hardcoded in Rack::JWT::Auth#return_error.

Since we have convention of error response in our stack I would like to introduce feature for customizing error messages by passing on_error option into middleware initializer

@ysv ysv changed the title Feature for customization error message in response [WIP] Feature for customization error message in response Oct 17, 2019
@ysv ysv changed the title [WIP] Feature for customization error message in response Add ability to customize response in case of error by passing callable object Oct 17, 2019
@ysv
Copy link
Author

ysv commented Oct 17, 2019

@eparreno could you take a look please

MissingAuthHeader => 'Missing Authorization header',
InvalidAuthHeaderFormat => 'Invalid Authorization header format'
}
message = error_message.fetch(error.class, 'Default')
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove Default here

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

Successfully merging this pull request may close these issues.

1 participant