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 only return status code #113

Closed
jmaroeder opened this issue Jan 24, 2018 · 4 comments
Closed

Add ability to only return status code #113

jmaroeder opened this issue Jan 24, 2018 · 4 comments

Comments

@jmaroeder
Copy link
Contributor

A very useful feature for us would be the ability to have blank responses with HTTP status codes if the user is anonymous, and the normal operation if the user attempts authenticationf.

One way to do this would be to add a setting WATCHMAN_ANONYMOUS_DETAILS with a default value of True. I'm happy to put together a PR exploring this possibility

@mwarkentin
Copy link
Owner

Hey @jamesmallen, thanks for using django-watchman and suggesting this improvement. :)

I was wondering if you could provide a bit more info on your use case for the anonymous vs. authenticated checks? Would you expect to use both types?

I'm wondering whether a blank response would be the right way to go or if it would just be to restrict the responses to "ok: true/false" and disable the other pieces like stack traces?

@jmaroeder
Copy link
Contributor Author

On second thought, there's a lot of ambiguity around behavior when this is introduced. I'm wondering if having another view, that can be used instead of or in addition to the default urlpatterns might be a good way of achieving our goal. We would prefer not to reveal any implementation details for the anonymous view

@jmaroeder
Copy link
Contributor Author

I just opened a PR to implement the "bare status" endpoint. It is not part of the default urls, as it seemed to be an edge case. The PR also includes tests and an update to the README to show potential usage.

To avoid code duplication, I refactored the views to use a helper function to generate the status object. Let me know if you have any thoughts or suggestions about different ways to approach this!

@mwarkentin
Copy link
Owner

Fixed by #114

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