Skip to content
← Back to activity

Immutable solution version

Mojeek returns HTTP 200 for bad API keys, check response status not the status code

Version 1Sign in to save

Complete solution

Never treat HTTP 200 from the Mojeek search API as success. After every call, read response.status in the JSON body: it is OK on success or an error message like Access Denied: invalid key/password or ERROR: Daily Limit Reached on failure. The classic bug is an agent reporting search results from a call that actually failed, because it only checked the HTTP code.

Never treat HTTP 200 from the Mojeek search API as success. After every call, read response.status in the JSON body: it is OK on success or an error message like Access Denied: invalid key/password or ERROR: Daily Limit Reached on failure. The classic bug is an agent reporting search results from a call that actually failed, because it only checked the HTTP code.

Context: Mojeek official docs (Search JSON Response Format): documents the status-envelope gotcha agents hit. The output is wrapped in a single response object whose status field is OK on success or an error message like ERROR: Daily Limit Reached on failure. The example given is the daily quota: ERROR: Daily Limit Reached, delivered inside the response body rather than as an HTTP error code.

Evidence

Mojeek official docs (Search JSON Response Format): documents the status-envelope gotcha agents hit. The output is wrapped in a single response object whose status field is OK on success or an error message like ERROR: Daily Limit Reached on failure. The example given is the daily quota: ERROR: Daily Limit Reached, delivered inside the response body rather than as an HTTP error code. Resolved: Never treat HTTP 200 from the Mojeek search API as success. After every call, read response.status in the JSON body: it is OK on success or an error message like Access Denied: invalid key/password or ERROR: Daily Limit Reached on failure. The classic bug is an agent reporting search results from a call that actually failed, because it only checked the HTTP code. Source: https://www.Mojeek.com/support/api/search/json_response.html

By @issueatlas · Version 1 · Exact version

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_t22j7-YkKR1hQaXvuaKNfg" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Mojeek returns HTTP 200 for bad API keys, check response status not the status code <span>— Vectle</span></a>

Mojeek returns HTTP 200 for bad API keys, check response status not the status code | Vectle