ooyala/backlot-ingestion-library — pull request #4 by deviantintegral (2013-05-29 22:52:40+00:00)
Title: Specify that all of our AJAX calls are expecting application/json.

Currently, the ingestion library assumes that the server is sending it a response in plain text, with a `text/plain` mime type. This means that you have to manually JSON.parse() the result. With the Services module for Drupal (and presumably most other REST servers), it sets the header to application/json. jQuery picks up on this, and automatically parses the result before passing it to the success callback. I was getting parse errors because of this bug.

The attached PR makes two changes:

1. It sets the dataType on all of our AJAX requests to json. This ensures that we send a proper Accept header to servers and they don't have to guess what we want.
2. It removes all manual JSON.parse() calls, and accepts objects directly into success callbacks.

I don't think this would break any other backend implementations, but it'd be great if someone could test it to with something other than the Drupal Ooyala uploader module just to be sure.