spring-cloud-gateway icon indicating copy to clipboard operation
spring-cloud-gateway copied to clipboard

Refactor header appending logic for better readability

Open dukbong opened this issue 11 months ago • 0 comments

This PR refactors the logic for adding headers in the appendXForwarded and appendForwarded methods.

Additionally upon reviewing both the original and refactored code, I noticed that in appendXForwarded, the result of headers.getFirst() is only checked for null. Wouldn't it be better to use StringUtils.hasText() instead, to ensure not only that the value is non-null but also that it contains text? What do you think about this approach?

dukbong avatar Jan 22 '25 12:01 dukbong