From cae92772565777e770bcd815e38130feee9af966 Mon Sep 17 00:00:00 2001 From: Sam Xu Date: Thu, 21 Apr 2022 22:22:25 -0700 Subject: [PATCH] Issue #349: Per-request query options are not preserved with the new $batch execution Customer may retrieve the query from main request ($batch) that will create IQueryFeature into the Main HttpContext, Once created, it will cached in the main HttpContext. We should remove IQueryFeature and don't pass that to the sub request. Otherwise, the sub request query string will never be used. --- .../Batch/ODataBatchReaderExtensions.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Microsoft.AspNetCore.OData/Batch/ODataBatchReaderExtensions.cs b/src/Microsoft.AspNetCore.OData/Batch/ODataBatchReaderExtensions.cs index 0c5b507c7..fea469c5b 100644 --- a/src/Microsoft.AspNetCore.OData/Batch/ODataBatchReaderExtensions.cs +++ b/src/Microsoft.AspNetCore.OData/Batch/ODataBatchReaderExtensions.cs @@ -227,7 +227,8 @@ private static HttpContext CreateHttpContext(HttpContext originalContext) kvp.Key == typeof(IODataFeature) || kvp.Key == typeof(IItemsFeature) || kvp.Key == typeof(IHttpRequestFeature) || - kvp.Key == typeof(IHttpResponseFeature)) + kvp.Key == typeof(IHttpResponseFeature) || + kvp.Key == typeof(IQueryFeature)) // Noted: we should not pass the QueryFeature from Main request to the sub request { continue; }