spring-cloud / spring-cloud/spring-cloud-openfeign

Trailing slash was added while posting to service context path

Open
#1,340 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

waiting-for-triage
Dominant language
Java
Stars
1.3k
Forks
838
Avg merge
2d 11h
Merged PRs (30d)
13

Description

There are two services, service A and service B.

in Service B, its context path is member and there is a controller defined as follow

@Contoller
public MemberController {
    @PostMapping
    public Member saveMember(Member member){
    }
}

and in Service A, a Feign client is defined to call this endpoint

@FeignClient(name = "service-b", path = "member")
public MemberFeignClient {
    @PostMapping
    public Member saveMember(Member member);
}

While executing the code, feign client print log with location calling to http://service-b/member/, which a trailing slash was added. I tried to add config from code or autoconfig to remove it but it was still added.

As Spring is no longer support trailing slash, it threw error as the path not found.

Version:
Spring Cloud OpenFeign: 5.0.1

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the request using the Service A Feign client and Service B controller shown in the issue, then trace how @FeignClient(path = "member") and @PostMapping combine into the request URL. Done when the generated POST target omits the trailing slash and a regression test covers this context-path case.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.