Closed LareinaH closed 5 years ago
Request Interceptors have always been applied after the template is resolved. That behavior is not new. Can you please provide a sample of your Request Interceptor to help us understand what you are trying to accomplish? We may be able to provide a workaround.
for example, several server apis are defined below:
@RequestLine("GET /openapi/api1/query1/{_accessId}/{param}") Object query1( @Param("param") String param ); @RequestLine("GET /openapi/api2/query2/{_accessId}/{param}") Object query2( @Param("param") String param ); @RequestLine("GET /openapi/api3/query3/{_accessId}/{param}") Object query3( @Param("param") String param );
@kdavisk6 {_accessId} param is common and same for all apis, before openfeign v10.2.0, RequestInterceptor could replace the common param in URI, but after v10.2.0, UriTemplate is init with ExpansionOptions.REQUIRED which makes /{_accessId}/ to // in RequestInterceptor process
@LareinaH
I'm surprised your example worked in previous versions. I suspect it was due to the many different, inconsistent template handling techniques we removed as part of 10.x. In order to remain compliant with RFC 6570, unresolved expressions that appear in the uri path are not allowed and must be removed, otherwise the result would be an invalid uri. Simply put, you cannot have an expression in the uri path that does not resolve and remain in the path.
Getting back to your issue, with the template being resolved before it is passed to the RequestInterceptor
, your current technique is not going to work any longer. You are going to need to revisit that design. Your best approach would be to change your method signatures to accept the accessId
as a method parameter, as that is the only option that will guarantee that accessId
is resolved and remains on the uri.
I'm going to close this issue and recommend that questions like this be made on Stack Overflow, allowing more users to help you.
in version 10.0.1, I could invoke template.resolve in RequestInterceptor to replace parameters in request path
while in version 10.2.0, I find it unavailable, for UriTemplate.resolve is execute before RequestInterceptor, and the expresion is ignored,
maybe uritemplate shoud init with ALLOW_UNRESOLVED below: