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

Not possible to modify content-type? #56

Open
ulsa opened this issue Aug 19, 2016 · 1 comment
Open

Not possible to modify content-type? #56

ulsa opened this issue Aug 19, 2016 · 1 comment

Comments

@ulsa
Copy link
Contributor

ulsa commented Aug 19, 2016

I'm using Buddy with Basic Auth and the api-defaults Ring middleware. The Unauthorized response gets a Content-Type of octet-stream. In a (Safari) browser, this results in an empty file being downloaded on Esc from the Basic Auth dialog.

I'm looking for a way to set Content-Type to say text/plain, but without having to re-create the same response as Buddy Auth. The only solution now seems to be to create a full response myself in the :on-error function.

@niwinz
Copy link
Member

niwinz commented Aug 22, 2016

Hmm, buddy by default does not set any header on the response, so the responsible to set that content-type header is something else. And yes, the proper way to fix it is just passing the :unauthorized-handler with function that handles that and returns appropriate response for your use case.

I don't think that adding an additional and specific parameter to the auth backend that will allow set a content-type header is a good solution for that problem. But I'm open to discussion ;)

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

No branches or pull requests

2 participants