Matrix parameters are not encoded correctly

Abierto
#395 14 comentarios 1 reacción 1 asignado Ver en GitHub

Los mantenedores suelen responder en 1 día

@OlgaMaciaszek ya está trabajando en esto.

Desde el 14/9/2020.

Evaluación

Este issue todavía no se ha evaluado.

Descripción

bug

(This leads on from https://github.com/spring-cloud/spring-cloud-openfeign/issues/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.

Lenguaje dominante
Java
Estrellas
1.3k
Forks
834
Merge medio
3 d 6 h
PR fusionados (30 d)
14

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de spring-cloud/spring-cloud-openfeign

Todos los issues de spring-cloud/spring-cloud-openfeign

Issues similares

Más issues de Java

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.