Skip to content

Feign Client is generating trailing slash in the request #1070

@lucasoares

Description

@lucasoares

Describe the bug

Spring is deprecating the trailing slash automatic support: spring-projects/spring-framework#28552

In my tests I notice all my servers using feign clients started to throw a not found error after the update.

Will spring cloud feign follow spring definitions and stop adding trailing slash? Or at least make it configurable? I'm reporting it as a bug since it is a breaking change in the spring versions.

Sample

package foo.bar.api;

import br.com.stilingue.upmslegacy.core.usergroup.entities.Company;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

@FeignClient(
    contextId = "TestApi",
    name = "TestApi",
    path = "/foo",
    url = "${my.api.test:}")
public interface CompanyLegacyApi {
  @GetMapping
  String getTest(@RequestParam String name);
}

When I use the #getTest method and my.api.test points to, for example, http://localhost:8080, the generated URL will be http://localhost:8080/foo/ instead of http://localhost:8080/foo, which will throw an error if requesting a server with the latest spring version.

I'm using spring boot 3.3.3 and 4.1.3 starter-openfeign.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions