shreyaaryaofficial opened a new pull request, #1391:
URL: https://github.com/apache/knox/pull/1391

   ## What changes were proposed in this pull request?
   
   This pull request adds dedicated unit tests for 
`XForwardedHeaderRequestWrapper` in the `gateway-server-xforwarded-filter` 
module.
   
   The tests provide focused coverage for the request wrapper's 
forwarded-header handling, including:
   
   * `X-Forwarded-For` header generation and handling of existing values.
   * `X-Forwarded-Proto` handling for HTTP and HTTPS requests.
   * Default forwarded ports (`80` for HTTP and `443` for HTTPS).
   * Preservation of existing `X-Forwarded-Port` values.
   * `X-Forwarded-Host` handling.
   * Case-insensitive forwarded-header lookup.
   * `X-Forwarded-Context` generation.
   * Service-context handling.
   * Service-name/context handling.
   * `getHeaders()` behavior for forwarded headers.
   * Forwarded host values containing port information.
   
   The change is limited to unit-test coverage and does not modify the 
production implementation.
   
   ## How was this patch tested?
   
   The new tests are implemented using the existing JUnit and EasyMock testing 
conventions used by the Apache Knox project.
   
   The following Maven command is used to run the new unit test and its 
required modules:
   
   ```bash
   mvn -pl gateway-server-xforwarded-filter -am \
   -Dtest=XForwardedHeaderRequestWrapperTest \
   -Dsurefire.failIfNoSpecifiedTests=false \
   test
   ```
   
   The test verifies the expected forwarded-header values for different request 
configurations, including HTTP/HTTPS requests, existing forwarded headers, 
context paths, service contexts, and case-insensitive header access.
   
   The Maven build also performs the project's existing validation steps, 
including Checkstyle.
   
   ## Integration Tests
   
   No integration tests were added or modified.
   
   This change only adds unit-test coverage for existing 
`XForwardedHeaderRequestWrapper` behavior and does not introduce or modify any 
user-facing functionality or integration behavior. Therefore, changes to 
`.github/workflows/tests` are not required.
   
   ## UI changes
   
   No UI changes are included in this pull request.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to