rails/rails — pull request #6394 by darragh (2012-05-19 11:22:04+00:00)
Title: http basic auth failures respect request.accept for json/xml

I noticed that rails http authentication currently always returns a string like "HTTP Basic: Access denied." regardless of the request Accept header.

We got reports of this causing some clients problems (I guess they are expecting json, and always attempting to parse the body as json).

I thought I'd experiment with modifying rails to respond with some valid json when accept is for json, and likewise for xml.

Is this a good idea?

for json it will now return something like:

```json
{"error":"HTTP Basic: Access denied."}
```

or xml
```xml
HTTP Basic: Access denied.
```