Archived from the Transloadit support forum. Originally posted on November 15, 2010; details may be outdated, see our docs for current behavior. Original thread
Currently, when Transloadit posts a notification back to my server, the notification JSON comes is bundled in a multipart form, with Content-Disposition: form-data.
I’m handling this notification post-back on my server in a CouchDB update handler, which doesn’t currently parse multipart request bodies, so I have to do parse the JSON response out manually, something like:
var boundary = req.headers['Content-Type'].match(/boundary=(.*)/)[1];
var regexp = new RegExp(boundary + '\r\nContent-Disposition: form-data; name=\"transloadit\"\r\n\r\n(.*)');
var notification = JSON.parse(req.body.match(regexp)[1]);
…but I’d prefer to not have to do this messy regexp work (this naive implementation works, but it’s obviously brittle.)
Wondering if it would be possible to create an option so that I can receive a notification as a non-multipart form? Afaik, the multipart is unnecessary here, given that the notification POST only contains one field that returns JSON.
Ideally, Transloadit would POST to me the JSON in the request body as Content-Type: application/json, so that my web server can intelligently parse out the JSON for me. No need to package this in a form field named “transloadit” if there are no other fields.