1

Closed

Handle Breeze client (and datajs?) relative URLs within odata/$batch requests

description

Relative URLs for sub-requests within an odata\$batch request are currently resolved in a way that seems intuitive, but is not consistent with what DefaultODataBatchHandler does, and it's resulting in 404 subresponses.

Eg for this example: http://www.getbreezenow.com/samples/breeze-web-api-odata

Request:

--batch_3282-396a-353f
Content-Type: multipart/mixed; boundary=changeset_b5e1-6019-8b2f

--changeset_b5e1-6019-8b2f
Content-Type: application/http
Content-Transfer-Encoding: binary

POST odata/TodoItems HTTP/1.1
Content-ID: 1
DataServiceVersion: 2.0
Accept: application/atomsvc+xml;q=0.8, application/json;odata=fullmetadata;q=0.7, application/json;q=0.5, */*;q=0.1
Content-Type: application/json
MaxDataServiceVersion: 3.0

{"Id":-2,"TodoListId":4,"Description":"falalalala","IsDone":false}
--changeset_b5e1-6019-8b2f--

--batch_3282-396a-353f--
Response:
HTTP/1.1 202 Accepted
Cache-Control: no-cache
Pragma: no-cache
Content-Type: multipart/mixed; boundary=batchresponse_7e404dc1-7370-4f23-a33f-95e50da07c96
Expires: -1
Server: Microsoft-IIS/8.0
DataServiceVersion: 3.0
X-AspNet-Version: 4.0.30319
X-SourceFiles: =?UTF-8?B?Qzpcc3JjXGdpdGh1YlxCcmVlemVcT0RhdGFTYW1wbGUrRW50aXR5UmVwb3NpdG9yeVxPRGF0YUJyZWV6ZWpzU2FtcGxlXG9kYXRhXCRiYXRjaA==?=
X-Powered-By: ASP.NET
Date: Thu, 25 Dec 2014 21:33:14 GMT
Content-Length: 681

--batchresponse_7e404dc1-7370-4f23-a33f-95e50da07c96
Content-Type: multipart/mixed; boundary=changesetresponse_7915c1a7-3901-445f-b8bc-12cc49605dec

--changesetresponse_7915c1a7-3901-445f-b8bc-12cc49605dec
Content-Type: application/http
Content-Transfer-Encoding: binary

HTTP/1.1 404 Not Found
Content-ID: 1
Content-Type: application/json; charset=utf-8

{"Message":"No HTTP resource was found that matches the request URI 'http://localhost:55802/odata/odata/TodoItems'.","MessageDetail":"No type was found that matches the controller named 'odata'."}
--changesetresponse_7915c1a7-3901-445f-b8bc-12cc49605dec--
--batchresponse_7e404dc1-7370-4f23-a33f-95e50da07c96--
Closed Dec 27, 2014 at 6:41 AM by johncrim
Resolving this - the current behavior is correct (correct resolution of relative URIs within a $batch request), per the odata 3 and odata 4 spec. The fix can be made on the Breeze client, as specified in the linked issue.

comments

johncrim wrote Dec 25, 2014 at 9:25 PM

This issue is documented in other places:

https://aspnetwebstack.codeplex.com/discussions/465262
http://jaydata.org/forum/viewtopic.php?f=3&t=300
https://github.com/IdeaBlade/Breeze/pull/28

So it's not immediately clear whether fixing this is correct or not.

johncrim wrote Dec 25, 2014 at 9:45 PM