spring - @RequestHeader mapped value contains header twice -
we facing super strange problem: in our endpoint:
@postmapping(value = "/send_event_to_payment_process") @async public void sendevent(@valid @requestbody final sendeventrequestdto dto, @requestheader(value = tenant) string foo) { the mapped @requestheader variable foo contains vaue twice joined ',' ("test,test"). if read header programmatically using request context:
public void sendevent(@valid @requestbody final sendeventrequestdto dto, @context final httpservletrequest request) { final string tenant = request.getheader(tenant); we receive proper value (only once: "test").
any clues problem might be?!
thank you!
you comparing different things.
the httpservletrequest.getheader method returns single value, if there multiple values header. return first (see javadoc of method).
spring uses httpservletrequest::getheaders method values. retrieves header values and, depending on value, return string[] or creates single concatenated string.
to compare same things should use getheaders method , have same result. means request contains 2 header values given header.
Comments
Post a Comment