0

The basic problem here is that an empty 200 OK triggers the error function instead of the success function. The API forces a content type (JSON or XML) that the $http object automatically attempts to parse. Both require a root object to parse successfully, so the $http object throws the error response instead of the success. The error function also doesn't include the status code (it's in the object but always set to 0 regardless of the actual response code; same with the error value), so I need some way to inject code before/during the parsing step to make it succeed on an empty 200 response.

Shaman
  • 213
  • 1
  • 9
  • What's your question? – Stewie Jun 17 '13 at 11:39
  • Does anyone know how to do the thing I said I need to do? "I need some way to inject code before/during the parsing step to make it succeed on an empty 200 response." The rest is an explanation of why I need that and 'solutions' that haven't worked. – Shaman Jun 17 '13 at 16:13
  • Try with response interceptors (see [$http](http://docs.angularjs.org/api/ng.$http) docs). – Stewie Jun 17 '13 at 16:28
  • I did try response interceptors but (unless I did it wrong) they come in after parsing, so its already error-ed and I can't get a status code. Any other thoughts? – Shaman Jun 17 '13 at 17:54

1 Answers1

0

The short answer here is that I can't, because the POSTs are cross-site. The contents are intentionally empty, but would appear empty regardless because of the way cross-site posting works. This is also the reason no status code is available which is what causes the error branch to be hit regardless of any attempts to manipulate the results via transformResponse.

Shaman
  • 213
  • 1
  • 9