Skip to content

Commit 0ea082e

Browse files
authored
fix: use dash instead of underscore (#15166)
1 parent bb5fd18 commit 0ea082e

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

tests/unit/captcha/test_hcaptcha.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ def test_invalid_error_code(self):
183183
responses.add(
184184
responses.POST,
185185
hcaptcha.VERIFY_URL,
186-
json={"success": False, "error_codes": ["foo"]},
186+
json={"success": False, "error-codes": ["foo"]},
187187
)
188188
serv = hcaptcha.Service.create_service(context=None, request=_REQUEST)
189189

@@ -200,7 +200,7 @@ def test_valid_error_code(self):
200200
hcaptcha.VERIFY_URL,
201201
json={
202202
"success": False,
203-
"error_codes": ["invalid-or-already-seen-response"],
203+
"error-codes": ["invalid-or-already-seen-response"],
204204
},
205205
)
206206
serv = hcaptcha.Service.create_service(context=None, request=_REQUEST)

warehouse/captcha/hcaptcha.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ def verify_response(self, response, remote_ip=None) -> ChallengeResponse | None:
149149

150150
if resp.status_code != http.HTTPStatus.OK or not data["success"]:
151151
try:
152-
error_codes = data["error_codes"]
152+
error_codes = data["error-codes"]
153153
except KeyError as e:
154154
raise UnexpectedError(
155155
f"Response missing 'error-codes' key: {data}"

0 commit comments

Comments
 (0)