crpc: add availability to set/get headers #802
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.
This pull request introduces comprehensive support for HTTP header manipulation in the CRPC
Requeststruct, enabling developers to read, set, add, and delete headers in a structured and case-insensitive manner. It also includes extensive documentation, tests, and examples to demonstrate the new functionality.Core Enhancements to CRPC Header Handling:
Header Support in
RequestStruct:Headerfield of typehttp.Headerto theRequeststruct for storing HTTP headers.ServeHTTPmethod to populate theHeaderfield from incoming HTTP requests.New Header Manipulation Methods:
GetHeader,SetHeader,AddHeader, andDelHeadermethods for accessing and modifying headers in a case-insensitive manner. These methods ensure nil safety and use Go'stextproto.CanonicalMIMEHeaderKeyfor canonicalization.Documentation and Examples:
Documentation:
CRPC Header Supportdocumentation inHEADERS.md, detailing usage of the new header manipulation methods with examples.Example Code:
example_headers_test.godemonstrating how to read and manipulate headers in CRPC request handlers.Testing:
Unit Tests:
GetHeader,SetHeader,AddHeader, andDelHeadermethods to validate their functionality, including edge cases like nil headers and case insensitivity.Integration Tests: