simple-odata-client/Simple.OData.Client

Allow changing individual request headers inside batch request

swidz opened this issue · 0 comments

Current functionality allows adding request headers either by HttpClient (HttpClient.DefaultRequestHeaders.Add) or by using ODataClientSettings.BeforeRequest delegate or by using WithHeader/WithHeaders methods directly on IODataClient or ODataBatch.

These all methods set message headers and work fine in case of single operation requests.
In case of batch requests using ODataBatch.WithHeader changes only the multipart message header but does not have any effect in headers on inner operation headers.

adding operations to batch, with WithHeader, does not do anything.

batch += async c => await c
  .For("entitycollectionname")
  .WithHeader("key1", "value1")
  .WithHeader("key2", "value2")
  .Set(entity)                        
  .InsertEntryAsync(false, cancellationToken);

Ability to control inner operation headers individually inside the batch request is required to pass special annotations for servers like SAP or Microsoft Dataverse and Microsoft Dynamics 365 CRM.

  1. As first step it would be really helpful if at least main headers were passed to inner headers.
  2. Second step would be to use .WithHeader/.WithHeaders methods from requests added to batch.

Best regards,
Sebastian