防止假冒在URL中添加斜杠

问题描述 投票:3回答:1

我正在尝试通过使用下面的Feign客户端在Spring Boot应用程序中检索在线图像内容。

@FeignClient(name = "image")
public interface ImageClient {

    @RequestMapping(method = RequestMethod.GET)
    byte[] getContent(URI uri) throws WebException;

}

我遇到的问题是,当我使用诸如https://images.foo.com/1234567/5c5a7f14-d5d4-4a79-9c2e-78fed8b738c5.jpeg?foo=123之类的URL调用getContent方法时,对https://images.foo.com/1234567/5c5a7f14-d5d4-4a79-9c2e-78fed8b738c5.jpeg/?foo=123进行了HTTP调用,并且从服务器收到错误消息。

有什么方法可以防止Feign在查询参数之前添加斜杠吗?

spring-cloud-feign feign
1个回答
0
投票

为避免分割网址

@@ FeignClient(name =“ image”,value url =“ BASE”)公共接口ImageClient {

@RequestMapping(method = RequestMethod.GET ,value  = "X" )
byte[] getContent(URI uri) throws WebException;

}

最后是B / X,没有尾随/添加

© www.soinside.com 2019 - 2024. All rights reserved.