Skip to content

Matrix parameters are not encoded correctly #395

Open
@nickcodefresh

Description

@nickcodefresh

(This leads on from #334 - apologies but at the time I didn't have enough spare time to create a sample application, but I now have).

When I try to use matrix parameters and Hoxton.SR7, they are encoded incorrectly. For example, assuming I have the folloing Feign client interface:

@FeignClient(url = "http://localhost:8080", name="name")
public interface FeignDemo {
    @GetMapping(value = "/api/server{account}")
    void server(@MatrixVariable("account") String account);
}

when making requests the URL is resolved as http://localhost:8080/api/server%3Baccount%3Da rather than the expected http://localhost:8080/api/server;account=a`:

2020-08-17 17:01:45.519 ERROR 23616 --- [nio-8080-exec-2] o.a.c.c.C.[.[.[/].[dispatcherServlet]    : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is feign.FeignException$BadRequest: [400] during [GET] to [http://localhost:8080/api/server%3Baccount%3Da] [FeignDemo#server(String)]: [{"timestamp":"2020-08-17T16:01:45.484+00:00","status":400,"error":"Bad Request","message":"","path":"/api/server%3Baccount%3Da"}]] with root cause

feign.FeignException$BadRequest: [400] during [GET] to [http://localhost:8080/api/server%3Baccount%3Da] [FeignDemo#server(String)]: [{"timestamp":"2020-08-17T16:01:45.484+00:00","status":400,"error":"Bad Request","message":"","path":"/api/server%3Baccount%3Da"}]

I have written the sample project https://github.com/nickcodefresh/spring-cloud-openfeign-334 to demo this issue. If you start the application and hit http://localhost:8080/api/client you'll see the error.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions