reddit/reddit — pull request #732 by buddydvd (2013-04-04 19:36:47+00:00)
Title: Add "/api/needs_captcha" method to determine if CAPTCHA are needed.

This pull request proposes a new API method — `POST_needs_captcha` — that provides API clients a clean way to determine whether CAPTCHAs are needed when making certain API calls.

Right now, there two ways to determine whether CAPTCHAs are needed (list beneath each item describes their issues):

1. Make an API call without specifying `captcha` and `iden` and look at the response for `BAD_CAPTCHA` error.
- Produces unnecessary error messages on the server side
- Forces user interface to implement a two-page form or two-step process
2. Make a request for the HTML version of the corresponding web form (e.g. http://www.reddit.com/submit) and search the response text for the CAPTCHA iden token (e.g. regex: `""`).
- Error prone against HTML template changes
- Require downloading unnecessary data (all the HTML surrounding the embedded iden)

The proposed API method resolves these issues.