Request parameter name cannot start with $ sign - regression
See original GitHub issueThe following has been observed in spring-cloud-openfeign when using request parameter name that starts with $ sign. It’s been caused by upgrading to version 10.x.
The issue has been reported here https://github.com/spring-cloud/spring-cloud-openfeign/issues/109.
public interface Client {
@GetMapping("/api")
Result api(@RequestParam("$filter") String filter);
}
Calling client.api("123")
used to work in any 2.0.x release even 2.1.0.RC2 was fine. Java call was translated into
GET /api?%24filter=123 HTTP/1.1
After upgrading to 2.1.0.RELEASE or 2.1.0.RC3 it looks like this
GET /api?%24filter=%7B%24filter%7D HTTP/1.1
The {$filter}
query param is passed correctly to Feign, but there as it’s being converted into a feign.template.Expressions
type feign.template.TemplateChunk
, it does not pass the following pattern matching filter:
static {
expressions = new LinkedHashMap<>();
expressions.put(Pattern.compile("\\+(\\w[-\\w.]*[ ]*)(:(.+))?"), ReservedExpression.class);
expressions.put(Pattern.compile("(\\w[-\\w.]*[ ]*)(:(.+))?"), SimpleExpression.class);
}
Optional<Entry<Pattern, Class<? extends Expression>>> matchedExpressionEntry =
expressions.entrySet()
.stream()
.filter(entry -> entry.getKey().matcher(expression).matches())
.findFirst();
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:14 (7 by maintainers)
Top Results From Across the Web
java - How to get query parameter name from ... - Stack Overflow
The problem is, I cannot find an object that is carrying query parameter name. Seems like the ConstraintViolationException doesn't have it. I ...
Read more >Troubleshoot the Regression suite automation tool
To troubleshoot errors when generating test execution and parameter files, enable generator logs. Open the Microsoft.Dynamics.RegressionSuite.
Read more >Python - Variable Names - W3Schools
Rules for Python variables: A variable name must start with a letter or the underscore character; A variable name cannot start with a...
Read more >Error/Warning Messages - Estima
Called Parameter by Value? If a PROCEDURE parameter is called by value, you cannot change the value stored in that variable. If necessary,...
Read more >Visual Studio 2022 "Value cannot be null. Parameter name ...
9Votes. Visual Studio 2022 "Value cannot be null. Parameter name textView" on Ctrl-f quick find.. SDSteve Doiel. - Reported Dec 09, 2021. [regression]...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I might have missed something, but does RFC 6570 not allow for pct-encoded values? Because I still had this issue when using
"%24filter"
.Using a
Map
still works, of course, so that’s the workaround I ended up resorting to.This workaround works as expected. Although as the list of parameters gets bigger it’s better to keep everything in one place, i.e. method parameters.
Another way how to provide parameters is a Map. Client definition would be
And you can call it
Funny thing is that this time it works without workdaround and the
$
character in the parameter name is not a problem.