dromara / forest

A high-level and lightweight declarative HTTP client framework for Java. it makes sending HTTP requests in Java easier.
MIT License
1.71k stars 217 forks source link

重定向后URL的Query参数会重复增加 #197

Open superBiuBiuMan opened 7 months ago

superBiuBiuMan commented 7 months ago

在gitee上看到了这个问题,现在依旧有这个问题好像 使用

        <dependency>
            <groupId>com.dtflys.forest</groupId>
            <artifactId>forest-spring-boot-starter</artifactId>
            <version>1.5.36</version>
        </dependency>

测试代码

  try{
            ForestRequest<?> forestRequest = Forest.get("http://hsw00.com/x2/?fromuid=2613");
            String execute = forestRequest.executeAsString();
        }catch (Exception e){
            e.printStackTrace();
        }

可以执行上面这段代码, 在浏览器里面, 首次访问http://hsw00.com/x2/?fromuid=2613会301 重定向到访问http://hsw00.com/x2/portal.php?fromuid=2613

2024-04-03 15:52:43.450 [Forest] Http Backend: okhttp3
2024-04-03 15:52:43.541 [Forest] Request (okhttp3): 
    GET http://hsw00.com/x2/?fromuid=2613 HTTP
    Headers: 
        User-Agent: forest/1.5.36
2024-04-03 15:52:44.121 [Forest] Response: Status = 301, Time = 569ms
2024-04-03 15:52:44.124 [Forest] Request (okhttp3): 
    [Redirect]: From GET http://hsw00.com/x2/ -> 301
    GET http://hsw00.com/portal.php?fromuid=2613?fromuid=2613 HTTP
    Headers: 
        User-Agent: forest/1.5.36
2024-04-03 15:52:44.394 [Forest] Response: Status = 404, Time = 270ms

日志显示访问到了http://hsw00.com/portal.php?fromuid=2613?fromuid=2613 参数被重复了....