spring-cloud / spring-cloud-openfeign

Support for using OpenFeign in Spring Cloud apps
Apache License 2.0
1.17k stars 756 forks source link

SpringMvcContract support parse params #1016

Closed Puppy4C closed 1 month ago

Puppy4C commented 3 months ago

Previously, SpringMvcContract did not support parsing the params parameter of @RequestMapping.

Example:

  1. Define a rest interface that uses the params parameter:
    @PutMapping(value = "/user", params = "action=disable")
    public String disableUser() {
    return "user";
    }
  2. Define a FeignClient to call the previously declared interface:
@FeignClient("user-server")
static interface UserService {
    @PutMapping(value = "/user", params = "action=disable")
    String disableUser();
}

When sending this request, the request path will be resolved to /user instead of /user?action=disable, resulting in 400 errors. Therefore, this PR provides the ability to parse params parameter.

pivotal-cla commented 3 months ago

@Puppy4C Please sign the Contributor License Agreement!

Click here to manually synchronize the status of this Pull Request.

See the FAQ for frequently asked questions.

pivotal-cla commented 3 months ago

@Puppy4C Thank you for signing the Contributor License Agreement!

OlgaMaciaszek commented 2 months ago

@Buzzardo could you please review the documentation changes?

OlgaMaciaszek commented 2 months ago

Thanks a lot @Buzzardo. @Puppy4C please apply the documentation changes suggested by @Buzzardo.

Puppy4C commented 2 months ago

Hi @OlgaMaciaszek,Done