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
Added /ping to /api/v2 #147
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
couple of small things to fix up.
if the caching headers for /ping are different from caching headers for other responses, please leave a comment in def ping()
src/publisher/api_v2_urls.py
Outdated
@@ -2,6 +2,7 @@ | |||
from . import api_v2_views as views | |||
|
|||
urlpatterns = [ | |||
url(r'/ping$', views.ping, name='ping'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no leading slash
src/publisher/api_v2_views.py
Outdated
def ping(request): | ||
"returns a test response" | ||
# produce standard authenticated header | ||
is_authenticated(request) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this isn't doing anything. is_authenticated
has no side effects
src/publisher/api_v2_views.py
Outdated
"returns a test response" | ||
# produce standard authenticated header | ||
is_authenticated(request) | ||
return Response('pong', content_type='text/plain; charset=UTF-8', headers={'Cache-Control': 'must-revalidate, no-cache, no-store, private'}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if these cache headers are different for the /ping endpoint than for all the others, then this is fine, otherwise, caching headers are handled in custom middleware in core.middleware
(beneath the kong authentication middleware) and this can be removed.
resp = self.c.get(reverse('v2:ping')) | ||
self.assertEqual(resp.status_code, 200) | ||
self.assertEqual(resp.content_type, 'text/plain; charset=UTF-8') | ||
self.assertEqual(resp['Cache-Control'], 'must-revalidate, no-cache, no-store, private') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
again, double handling if /ping cache headers are no different from regular caching headers.
Documenting why the cache headers are different
Changes made |
For some reason this failed when in |
To be targeted by journal in its status page and possibly by monitoring.