Quantcast
Channel: ASPNETWebStack Issue Tracker Rss Feed
Viewing all articles
Browse latest Browse all 7215

Created Unassigned: OData $batch sends the wrong response when a request within a changeset fails [1033]

$
0
0
Given a $batch request like the following, where the second operation in the changeset fails as this one

```
POST http://jcalvarro-wsr3:9001/batch/$batch HTTP/1.1
DataServiceVersion: 1.0;NetFx
MaxDataServiceVersion: 3.0;NetFx
Content-Type: multipart/mixed; boundary=batch_e4243eef-ba43-49da-8dfb-a006d9e918f2
Accept: multipart/mixed
Accept-Charset: UTF-8
User-Agent: Microsoft ADO.NET Data Services
Host: jcalvarro-wsr3:9001
Content-Length: 1076
Expect: 100-continue
Connection: Keep-Alive

--batch_e4243eef-ba43-49da-8dfb-a006d9e918f2
Content-Type: multipart/mixed; boundary=changeset_6bb58eec-2717-4673-b074-919584c38eea

--changeset_6bb58eec-2717-4673-b074-919584c38eea
Content-Type: application/http
Content-Transfer-Encoding: binary

POST http://jcalvarro-wsr3:9001/batch/BatchCustomer HTTP/1.1
Content-ID: 1
DataServiceVersion: 3.0;NetFx
MaxDataServiceVersion: 3.0;NetFx
Content-Type: application/json;odata=minimalmetadata
Accept: application/json;odata=minimalmetadata
Accept-Charset: UTF-8

{"Id":10,"Name":"Customer 10"}
--changeset_6bb58eec-2717-4673-b074-919584c38eea
Content-Type: application/http
Content-Transfer-Encoding: binary

POST http://jcalvarro-wsr3:9001/batch/BatchCustomer HTTP/1.1
Content-ID: 2
DataServiceVersion: 3.0;NetFx
MaxDataServiceVersion: 3.0;NetFx
Content-Type: application/json;odata=minimalmetadata
Accept: application/json;odata=minimalmetadata
Accept-Charset: UTF-8

{"Id":-1,"Name":"Customer -1"}
--changeset_6bb58eec-2717-4673-b074-919584c38eea--
--batch_e4243eef-ba43-49da-8dfb-a006d9e918f2--
```

the current response is the following

```

HTTP/1.1 202 Accepted
Content-Length: 886
Content-Type: multipart/mixed; boundary=batchresponse_47b1b595-6669-4b92-8cc9-eee0cba4517f
Server: Microsoft-HTTPAPI/2.0
DataServiceVersion: 3.0
Date: Mon, 06 May 2013 20:52:22 GMT

--batchresponse_47b1b595-6669-4b92-8cc9-eee0cba4517f
Content-Type: multipart/mixed; boundary=changesetresponse_138912bb-52f3-4731-ae06-013e250ca45f

--changesetresponse_138912bb-52f3-4731-ae06-013e250ca45f
Content-Type: application/http
Content-Transfer-Encoding: binary

HTTP/1.1 201 Created
Location: http://jcalvarro-wsr3:9001/batch/BatchCustomer(10)
Content-ID: 1
Content-Type: application/json; odata=minimalmetadata; charset=utf-8
DataServiceVersion: 3.0

{
"odata.metadata":"http://jcalvarro-wsr3:9001/batch/$metadata#BatchCustomer/@Element","Id":10,"Name":"Customer 10"
}
--changesetresponse_138912bb-52f3-4731-ae06-013e250ca45f
Content-Type: application/http
Content-Transfer-Encoding: binary

HTTP/1.1 400 Bad Request
Content-ID: 2


--changesetresponse_138912bb-52f3-4731-ae06-013e250ca45f--
--batchresponse_47b1b595-6669-4b92-8cc9-eee0cba4517f--
```

and according to the OData spec, it should be as follows:

Structurally, a batch response body MUST match one-to-one with the corresponding batch request body, such that the same multipart MIME message structure defined for requests is used for responses.
The exception to this rule is that when a request within a Change Set fails, the Change Set response is not represented using the multipart/mixed media type.
Instead, a single response, using the “application/http” media type and a Content-Transfer-Encoding header with a value of “binary”,
is returned that applies to all requests in the Change Set and MUST be formatted according to the Error Handling section of [OData:Core].

Viewing all articles
Browse latest Browse all 7215

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>