Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow changing individual request headers inside batch request #916

Open
swidz opened this issue Nov 29, 2023 · 0 comments
Open

Allow changing individual request headers inside batch request #916

swidz opened this issue Nov 29, 2023 · 0 comments

Comments

@swidz
Copy link

swidz commented Nov 29, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant