buddy-auth icon indicating copy to clipboard operation
buddy-auth copied to clipboard

Not possible to modify content-type?

Open ulsa opened this issue 9 years ago • 1 comments

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.

ulsa avatar Aug 19 '16 08:08 ulsa

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 ;)

niwinz avatar Aug 22 '16 05:08 niwinz