angular/angular.js — pull request #10357 by gkalpak (2014-12-07 13:08:13+00:00)
Title: fix($http): only parse as JSON when opening/closing brackets match

Previously, due to weak JSON-detecting RegExp, string like `[...}` and
`{...]` would be considered JSON (even if they obviously aren't) and an
expection would be thrown while trying to parse them.

This commit makes sure the opening and closing brackets match. This
doesn't completely eliminate false positives (e.g. `[]{}[]`), but does
help reduce them.

**Note:**
I don't consider this to be a breaking change, but if someone expects their app to throw when receiving a response like `'[...}'` or `'{...]'`, then this PR will break their app.