I use Feign client to call 3rd party rest services.
The url looks like: https://dev.azure.com/{organization}/{project}
Since we changed our project name to a string which contains spaces, I'm getting http 400 Bad Request as response.
@FeignClient(value = "azure", url = "https://dev.azure.com/Organization/Project%20Name/_apis/wit/")
public interface AzureFeignClient {
@GetMapping(value = "/workitems/{id}?api-version=7.0")
ResponseEntity<WorkItem> getWorkitemById(@PathVariable("id") int id);
Pom.xml:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.5</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<java.version>1.8</java.version>
<spring-cloud.version>2021.0.5</spring-cloud.version>
</properties>
....
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
.....
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
As you can see from the example I've encoded the spaces as %20 in the FeignClient value argument but it still not working. Any idea how to fix it?