Skip to content

Commit

Permalink
Merge pull request #490 from mesosphere/cosmos-header-bug
Browse files Browse the repository at this point in the history
fix cosmos header
  • Loading branch information
tamarrow committed Feb 24, 2016
2 parents 511e2d5 + 5cb690d commit 4e3bf34
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion dcos/cosmospackage.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def enabled(self):
try:
url = urllib.parse.urljoin(self.cosmos_url, 'capabilities')
response = http.get(url,
headers=_get_cosmos_header("capabilities"))
headers=_get_capabilities_header())
# return `Authentication failed` error messages, but all other errors
# are treated as endpoint not available
except DCOSAuthenticationException:
Expand Down Expand Up @@ -59,3 +59,14 @@ def _get_cosmos_header(request_name):

return {"Accept": _get_header("{}-response".format(request_name)),
"Content-Type": _get_header("{}-request".format(request_name))}


def _get_capabilities_header():
"""Returns header fields needed for a valid request to cosmos capabilities
endpoint
:returns: header information
:rtype: dict
"""

header = "application/vnd.dcos.capabilities+json;charset=utf-8;version=v1"
return {"Accept": header}

0 comments on commit 4e3bf34

Please sign in to comment.