How to process/parse/read a response that is of type "multipart/mixed; boundary=batch" using JavaScript/jQuery?
In our application we get a response as given below:
Is there a way to process these kind of responses? Or should we use raw string manipulations using regex, etc to get the content we want?
--batchresponse_e3e3tc10-1181-4b94-bb8a-952452769d53
Content-Type: multipart/mixed; boundary=changesetresponse_4sdflwerf-40ef-4347-8c77-b364e5d2e678
--changesetresponse_4sdflwerf-40ef-4347-8c77-b364e5d2e678
Content-Type: application/http
Content-Transfer-Encoding: binary
HTTP/1.1 201 Created
DataServiceVersion: 1.0;
Content-Type: application/json;odata=verbose;charset=utf-8
Content-ID: 1
X-Content-Type-Options: nosniff
Cache-Control: no-cache
Location: <url1>
{"Some": "JSON response"}
--changesetresponse_4sdflwerf-40ef-4347-8c77-b364e5d2e678
Content-Type: application/http
Content-Transfer-Encoding: binary
HTTP/1.1 204 No Content
Content-ID: 2
X-Content-Type-Options: nosniff
Cache-Control: no-cache
DataServiceVersion: 1.0;
--changesetresponse_4sdflwerf-40ef-4347-8c77-b364e5d2e678
Content-Type: application/http
Content-Transfer-Encoding: binary
HTTP/1.1 204 No Content
Content-ID: 3
X-Content-Type-Options: nosniff
Cache-Control: no-cache
DataServiceVersion: 1.0;
--changesetresponse_4sdflwerf-40ef-4347-8c77-b364e5d2e678--
--batchresponse_e3e3tc10-1181-4b94-bb8a-952452769d53--