Add support for custom headers in OData requests #175
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Implements optional custom header support for OData requests, addressing issue #23. This feature allows consumers to add authentication tokens, tracking headers, or other custom headers to their OData requests without requiring any changes to existing code.
Progress
Features
Client-Level Headers (Global)
Set headers that apply to all requests made by the client:
Query-Level Headers (Per-Request)
Add headers to specific queries using the fluent interface:
Key Benefits
Implementation Details
setHeaders(),getHeaders(), andaddHeader()methods toIODataClientinterfaceODataClientclasswithHeader()andwithHeaders()methods toQuery\Builderfor fluent per-query headersODataRequest->addHeaders()method for HTTP transmissionBackward Compatibility
This is a non-breaking change. All existing code will continue to work exactly as before. The custom headers feature is completely optional and only activated when explicitly used.
Testing
Includes comprehensive unit tests covering:
Documentation and usage examples have been added to the README, including a reference to a complete working example at
examples/custom_headers_example.php.💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.