Skip to content

Change the way request options can affect a request (breaking change)#22

Merged
rickykaare merged 1 commit intomainfrom
request-base-address
Jun 6, 2025
Merged

Change the way request options can affect a request (breaking change)#22
rickykaare merged 1 commit intomainfrom
request-base-address

Conversation

@rickykaare
Copy link
Contributor

No description provided.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces a breaking change in how headers are applied to HTTP requests by replacing the GetHeaders dictionary with a new method, ConfigureHttpRequest, to directly configure the HttpRequestMessage. Key changes include updating the IRequestOptions interface and its implementations in ClientRequestOptions and PagedRequestOptions, as well as adjusting MessageRequestBuilder to use the new approach.

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
src/Cabazure.Client.Runtime/PagedRequestOptions.cs Changed the override method from AppendHeaders to ConfigureHttpRequest and updated header assignment
src/Cabazure.Client.Runtime/IRequestOptions.cs Removed GetHeaders and updated documentation to reflect the new ConfigureHttpRequest method
src/Cabazure.Client.Runtime/ClientRequestOptions.cs Replaced explicit implementation of GetHeaders with ConfigureHttpRequest directly modifying the request
src/Cabazure.Client.Runtime/Builder/MessageRequestBuilder.cs Updated the request building logic to invoke the new ConfigureHttpRequest method if request options are provided
Comments suppressed due to low confidence (3)

src/Cabazure.Client.Runtime/IRequestOptions.cs:11

  • Consider expanding the documentation for ConfigureHttpRequest to clearly describe how header merging and overriding should be handled by implementations.
/// Allows the options implementation to configure the HTTP request message.

src/Cabazure.Client.Runtime/ClientRequestOptions.cs:20

  • Clarify in the documentation that this explicit interface implementation applies headers directly to the request object instead of returning a header dictionary, to avoid confusion for API consumers.
void IRequestOptions.ConfigureHttpRequest(HttpRequestMessage request)

src/Cabazure.Client.Runtime/Builder/MessageRequestBuilder.cs:44

  • [nitpick] When both manually added headers and request options are used, consider clearly documenting the precedence or merging strategy to avoid potential header conflicts.
if (options is not null)

@rickykaare rickykaare merged commit 5067ca6 into main Jun 6, 2025
2 checks passed
@christianhelle christianhelle deleted the request-base-address branch June 6, 2025 10:28
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

Successfully merging this pull request may close these issues.

3 participants