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

Fix accepts header to be accept, the right one #57

Merged
merged 1 commit into from
Jun 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/keria/app/credentialing.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,8 +344,8 @@ def on_get(req, rep, aid, said):
if aid not in agent.hby.habs:
raise falcon.HTTPBadRequest(description=f"Invalid identifier {aid} for credentials")

accepts = req.get_header("accepts")
if accepts == "application/json+cesr":
accept = req.get_header("accept")
if accept == "application/json+cesr":
rep.content_type = "application/json+cesr"
data = CredentialResourceEnd.outputCred(agent.hby, agent.rgy, said)
else:
Expand Down
5 changes: 1 addition & 4 deletions tests/app/test_credentialing.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,12 +227,9 @@ def test_credentialing_ends(helpers, seeder):
assert res.headers['content-type'] == "application/json"
assert res.json['sad']['d'] == saids[0]

headers = {"Accepts": "application/json+cesr"}
headers = {"Accept": "application/json+cesr"}
res = client.simulate_get(f"/identifiers/{hab.pre}/credentials/{saids[0]}", headers=headers)
assert res.status_code == 400
assert res.json == {'description': 'Invalid identifier '
'EIqTaQiZw73plMOq8pqHTi9BDgDrrE7iE9v2XfN2Izze for credentials',
'title': '400 Bad Request'}

res = client.simulate_get(f"/identifiers/{issuee}/credentials/{saids[0]}", headers=headers)
assert res.status_code == 200
Expand Down