зеркало из https://github.com/mozilla/treeherder.git
Bug 1184542 - enable browsable api
I enabled the api html rendered so that if you fetch one of the endpoints using your browser (i.e. with a 'Accept: text/html' header) it will return the right content type. The default renderer is still the json one though, so it should be back-compatible.
This commit is contained in:
Родитель
877cfd3b33
Коммит
54075f99bf
|
@ -697,7 +697,8 @@ class TreeherderClient(object):
|
|||
else:
|
||||
uri = self._get_project_uri(project, endpoint)
|
||||
|
||||
resp = requests.get(uri, timeout=timeout, params=params)
|
||||
resp = requests.get(uri, timeout=timeout, params=params,
|
||||
headers={'Accept': 'application/json'})
|
||||
resp.raise_for_status()
|
||||
return resp.json()
|
||||
|
||||
|
|
|
@ -284,6 +284,7 @@ REST_FRAMEWORK = {
|
|||
),
|
||||
'DEFAULT_RENDERER_CLASSES': (
|
||||
'rest_framework.renderers.JSONRenderer',
|
||||
'rest_framework.renderers.BrowsableAPIRenderer',
|
||||
),
|
||||
'EXCEPTION_HANDLER': 'treeherder.webapp.api.exceptions.exception_handler',
|
||||
'DEFAULT_THROTTLE_CLASSES': (
|
||||
|
|
Загрузка…
Ссылка в новой задаче