Skip to content

Commit

Permalink
Allow Accept */*
Browse files Browse the repository at this point in the history
  • Loading branch information
jschlyter committed Jan 8, 2025
1 parent f4968d6 commit 3bb1753
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion nodeman/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class PublicKeyFormat(StrEnum):

@classmethod
def from_accept(cls, accept: str | None) -> Self:
if accept is None or cls.JWK in accept or "application/json" in accept:
if accept is None or cls.JWK in accept or "application/json" in accept or "*/*" in accept:
return cls.JWK
elif cls.PEM in accept:
return cls.PEM
Expand Down
5 changes: 5 additions & 0 deletions tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,11 @@ def _test_enroll(data_key: JWK, x509_key: PrivateKey, requested_name: str | None
res = JWK.from_json(response.text)
assert res.kid == name

response = client.get(public_key_url, headers={"Accept": "*/*"})
assert response.status_code == status.HTTP_200_OK
res = JWK.from_json(response.text)
assert res.kid == name

response = client.get(public_key_url, headers={"Accept": PublicKeyFormat.JWK})
assert response.status_code == status.HTTP_200_OK
res = JWK.from_json(response.text)
Expand Down

0 comments on commit 3bb1753

Please sign in to comment.