Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FeignStrategyInterceptor IllegalArgumentException #207

Open
generalrbb opened this issue Aug 28, 2024 · 2 comments
Open

FeignStrategyInterceptor IllegalArgumentException #207

generalrbb opened this issue Aug 28, 2024 · 2 comments

Comments

@generalrbb
Copy link

java.lang.IllegalArgumentException
message:
an expression is required.
stack:
java.lang.IllegalArgumentException: an expression is required.
at feign.template.Expressions.create(Expressions.java:50)
at feign.template.Template.parseFragment(Template.java:224)
at feign.template.Template.parseTemplate(Template.java:203)
at feign.template.Template.(Template.java:70)
at feign.template.HeaderTemplate.(HeaderTemplate.java:81)
at feign.template.HeaderTemplate.create(HeaderTemplate.java:57)
at feign.RequestTemplate.lambda$appendHeader$2(RequestTemplate.java:693)
at java.util.Map.compute(Map.java:1093)
at feign.RequestTemplate.appendHeader(RequestTemplate.java:691)
at feign.RequestTemplate.header(RequestTemplate.java:675)
at feign.RequestTemplate.header(RequestTemplate.java:657)
at com.nepxion.discovery.plugin.strategy.service.aop.FeignStrategyInterceptor.applyInnerHeader(FeignStrategyInterceptor.java:64)
at com.nepxion.discovery.plugin.strategy.service.aop.FeignStrategyInterceptor.apply(FeignStrategyInterceptor.java:49)
at feign.SynchronousMethodHandler.targetRequest(SynchronousMethodHandler.java:171)
at feign.SynchronousMethodHandler.executeAndDecode(SynchronousMethodHandler.java:101)
at feign.SynchronousMethodHandler.invoke(SynchronousMethodHandler.java:80)
at feign.ReflectiveFeign$FeignInvocationHandler.invoke(ReflectiveFeign.java:103)

@HaojunRen
Copy link
Member

HaojunRen commented Aug 29, 2024

What's the version of Nepxion Discovery? Maybe your heads have special character?

@HaojunRen
Copy link
Member

Refer to feign.template.Expressions

  public static Expression create(final String value) {

    /* remove the start and end braces */
    final String expression = stripBraces(value);
    if (expression == null || expression.isEmpty()) {
      throw new IllegalArgumentException("an expression is required.");
    }

    ...
  private static String stripBraces(String expression) {
    if (expression == null) {
      return null;
    }
    if (expression.startsWith("{") && expression.endsWith("}")) {
      return expression.substring(1, expression.length() - 1);
    }
    return expression;
  }

I guess your value is '{}'?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants