Aias00 commented on code in PR #7258:
URL: https://github.com/apache/shenyu/pull/7258#discussion_r4111194520
##########
shenyu-plugin/shenyu-plugin-response/src/main/java/org/apache/shenyu/plugin/response/strategy/WebClientMessageWriter.java:
##########
@@ -77,6 +82,7 @@ public Mono<Void> writeWith(final ServerWebExchange exchange,
final ShenyuPlugin
}
this.redrawResponseHeaders(response, fluxResponseEntity);
+ deduplicateResponseHeaders(exchange);
Review Comment:
Non-blocking suggestion: this is the only place the final header state is
decided, so re-applying here is the right call (the dedup done in
`WebClientPlugin.java:115` is undone by `redrawResponseHeaders`' `putAll` a few
lines above, which writes the raw upstream headers back).
One structural note: this method is a copy of
`AbstractHttpClientPlugin#duplicateHeaders` / `#duplicate`
(AbstractHttpClientPlugin.java:173-205). I checked every branch and they agree
- same `;` separator, same `RETAIN_FIRST` default, same three strategies, same
`default:` throw - so there is no behavioural drift today. But
`shenyu-plugin-response` does not depend on `shenyu-plugin-httpclient`, so the
copy is unavoidable only until the helper is lifted somewhere shared. #7230
also touches this knob; please make sure the two land on the same home for this
logic, otherwise the next strategy constant updates one switch and not the
other, and every response starts returning 500 from the `default:` branch.
##########
shenyu-plugin/shenyu-plugin-response/src/main/java/org/apache/shenyu/plugin/response/strategy/WebClientMessageWriter.java:
##########
@@ -77,6 +82,7 @@ public Mono<Void> writeWith(final ServerWebExchange exchange,
final ShenyuPlugin
}
this.redrawResponseHeaders(response, fluxResponseEntity);
+ deduplicateResponseHeaders(exchange);
Review Comment:
Non-blocking suggestion: this is the only place the final header state is
decided, so re-applying here is the right call (the dedup done in
`WebClientPlugin.java:115` is undone by `redrawResponseHeaders`' `putAll` a few
lines above, which writes the raw upstream headers back).
One structural note: this method is a copy of
`AbstractHttpClientPlugin#duplicateHeaders` / `#duplicate`
(AbstractHttpClientPlugin.java:173-205). I checked every branch and they agree
- same `;` separator, same `RETAIN_FIRST` default, same three strategies, same
`default:` throw - so there is no behavioural drift today. But
`shenyu-plugin-response` does not depend on `shenyu-plugin-httpclient`, so the
copy is unavoidable only until the helper is lifted somewhere shared. #7230
also touches this knob; please make sure the two land on the same home for this
logic, otherwise the next strategy constant updates one switch and not the
other, and every response starts returning 500 from the `default:` branch.
--
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]