{"action":"created","issue":{"url":"https://api.github.com/repos/OData/WebApi/issues/1663","repository_url":"https://api.github.com/repos/OData/WebApi","labels_url":"https://api.github.com/repos/OData/WebApi/issues/1663/labels{/name}","comments_url":"https://api.github.com/repos/OData/WebApi/issues/1663/comments","events_url":"https://api.github.com/repos/OData/WebApi/issues/1663/events","html_url":"https://github.com/OData/WebApi/issues/1663","id":376319396,"node_id":"MDU6SXNzdWUzNzYzMTkzOTY=","number":1663,"title":"OData query options are ignored in batch queries","user":{"login":"osven","id":32299167,"node_id":"MDQ6VXNlcjMyMjk5MTY3","avatar_url":"https://avatars1.githubusercontent.com/u/32299167?v=4","gravatar_id":"","url":"https://api.github.com/users/osven","html_url":"https://github.com/osven","followers_url":"https://api.github.com/users/osven/followers","following_url":"https://api.github.com/users/osven/following{/other_user}","gists_url":"https://api.github.com/users/osven/gists{/gist_id}","starred_url":"https://api.github.com/users/osven/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/osven/subscriptions","organizations_url":"https://api.github.com/users/osven/orgs","repos_url":"https://api.github.com/users/osven/repos","events_url":"https://api.github.com/users/osven/events{/privacy}","received_events_url":"https://api.github.com/users/osven/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"biaol-odata","id":24885233,"node_id":"MDQ6VXNlcjI0ODg1MjMz","avatar_url":"https://avatars2.githubusercontent.com/u/24885233?v=4","gravatar_id":"","url":"https://api.github.com/users/biaol-odata","html_url":"https://github.com/biaol-odata","followers_url":"https://api.github.com/users/biaol-odata/followers","following_url":"https://api.github.com/users/biaol-odata/following{/other_user}","gists_url":"https://api.github.com/users/biaol-odata/gists{/gist_id}","starred_url":"https://api.github.com/users/biaol-odata/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/biaol-odata/subscriptions","organizations_url":"https://api.github.com/users/biaol-odata/orgs","repos_url":"https://api.github.com/users/biaol-odata/repos","events_url":"https://api.github.com/users/biaol-odata/events{/privacy}","received_events_url":"https://api.github.com/users/biaol-odata/received_events","type":"User","site_admin":false},"assignees":[{"login":"biaol-odata","id":24885233,"node_id":"MDQ6VXNlcjI0ODg1MjMz","avatar_url":"https://avatars2.githubusercontent.com/u/24885233?v=4","gravatar_id":"","url":"https://api.github.com/users/biaol-odata","html_url":"https://github.com/biaol-odata","followers_url":"https://api.github.com/users/biaol-odata/followers","following_url":"https://api.github.com/users/biaol-odata/following{/other_user}","gists_url":"https://api.github.com/users/biaol-odata/gists{/gist_id}","starred_url":"https://api.github.com/users/biaol-odata/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/biaol-odata/subscriptions","organizations_url":"https://api.github.com/users/biaol-odata/orgs","repos_url":"https://api.github.com/users/biaol-odata/repos","events_url":"https://api.github.com/users/biaol-odata/events{/privacy}","received_events_url":"https://api.github.com/users/biaol-odata/received_events","type":"User","site_admin":false}],"milestone":null,"comments":2,"created_at":"2018-11-01T09:38:52Z","updated_at":"2018-11-05T20:18:39Z","closed_at":null,"author_association":"NONE","body":"<!-- markdownlint-disable MD002 MD041 -->\r\n\r\nI have a ASP.NET OData service on top of a database. The service accepts queries with options, e.g.;\r\n\r\n[...]/Well?$select=Id,Name,FieldName&$orderby=Name&$filter=ForecastId eq 123&$format=json\r\n\r\nThis request works as expected when it is sent as a plain GET request. But when the same request is sent as a $batch request the query options are ignored. It seems that the query string is not parsed when the GET request message is created from the batch request body.\r\n\r\n### Assemblies affected\r\n\r\nMicrosoft.AspNetCore.App 2.1.4\r\nMicrosoft.AspNetCore.OData 7.0.1\r\n\r\n### Reproduce steps\r\n\r\nRequest header:\r\n\r\nAccept: multipart/mixed\r\nContent-Type: multipart/mixed;boundary=batch_563f44e9-35b9-35ac-b21d-963524e695ab\r\nAccept-Language: nb,en-GB;q=0.8,en;q=0.5,nn;q=0.3\r\n\r\nRequest body:\r\n\r\n--batch_563f44e9-35b9-35ac-b21d-963524e695ab\r\nContent-Type: application/http\r\nContent-Transfer-Encoding:binary\r\n\r\nGET [...]/Well?$select=Id,Name,FieldName&$orderby=Name&$filter=ForecastId eq 123&$format=json HTTP/1.1\r\n\r\n--batch_563f44e9-35b9-35ac-b21d-963524e695ab\r\n\r\n### Expected result\r\n\r\nThe response should contain only the specified columns, the returned rows should be limited as specified by the filter, and they should be ordered by **Name**.\r\n\r\n### Actual result\r\n\r\nThe response contains all columns and all rows from the table, and the result is not sorted.\r\n\r\n### Additional detail\r\n\r\nWhen inspecting the **HttpContext.Request** object, I observe that the **QueryString** property is set correctly in both cases:\r\n\r\n?$select=Id,Name,FieldName&$orderby=Name&$orderby=Name&$filter=ForecastId%20eq%20123&$format=json\r\n\r\n But in the batch case the **Query** collection is empty. In the non-batch case the **Query** collection contains the four options as expected.\r\n\r\nOtherwise batching seems to work as expected.\r\n"},"comment":{"url":"https://api.github.com/repos/OData/WebApi/issues/comments/436020474","html_url":"https://github.com/OData/WebApi/issues/1663#issuecomment-436020474","issue_url":"https://api.github.com/repos/OData/WebApi/issues/1663","id":436020474,"node_id":"MDEyOklzc3VlQ29tbWVudDQzNjAyMDQ3NA==","user":{"login":"biaol-odata","id":24885233,"node_id":"MDQ6VXNlcjI0ODg1MjMz","avatar_url":"https://avatars2.githubusercontent.com/u/24885233?v=4","gravatar_id":"","url":"https://api.github.com/users/biaol-odata","html_url":"https://github.com/biaol-odata","followers_url":"https://api.github.com/users/biaol-odata/followers","following_url":"https://api.github.com/users/biaol-odata/following{/other_user}","gists_url":"https://api.github.com/users/biaol-odata/gists{/gist_id}","starred_url":"https://api.github.com/users/biaol-odata/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/biaol-odata/subscriptions","organizations_url":"https://api.github.com/users/biaol-odata/orgs","repos_url":"https://api.github.com/users/biaol-odata/repos","events_url":"https://api.github.com/users/biaol-odata/events{/privacy}","received_events_url":"https://api.github.com/users/biaol-odata/received_events","type":"User","site_admin":false},"created_at":"2018-11-05T20:18:39Z","updated_at":"2018-11-05T20:18:39Z","author_association":"MEMBER","body":"@osven Then looks like the request arriving at the $batch service endpoint does not have the query options in the request URL? The batch will be process without the query options in such case.\r\n\r\nI would recommend examination of the request message on the wire from client side. If it is good, examine request message on the wire from service side, and subsequently upper layer processing before the request arrives at the $batch EP."}}
{"actor":{"display_login":"biaol-odata"}}