Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

当未指定请求方法名,默认请求方法应该为get,实际请求方法为delete #215

Open
rank97 opened this issue Nov 29, 2024 · 1 comment

Comments

@rank97
Copy link

rank97 commented Nov 29, 2024

当前使用Forest版本以及所使用的后端及版本

Forest: 1.5.36
Backend: (okhttp或httpclient)/version

该问题是如何引起的?

定义 Forest 请求接口方法名为 delete 的时候,@request(url = "/user/delete")未指定请求方法名,此时请求方法应该为get,但是请求方法为delete

重现步骤(如果有请写完整)

public interface Myclient {
@request(url = "/user/delete")
String delete();
}

报错信息/完整请求日志(如果没有请求日志请把开关打开)

16:21:32.689 [http-nio-8080-exec-1] INFO c.d.forest.logging.DefaultLogHandler - [Forest] Request (okhttp3):
DELETE http://127.0.0.1/user/delete HTTP
Headers:
User-Agent: forest/1.5.36
16:21:32.708 [http-nio-8080-exec-1] INFO c.d.forest.logging.DefaultLogHandler - [Forest] Response: Status = 405, Time = 15ms

接口定义(必要时请提供)

public interface Myclient {
@request(url = "/user/delete")
String delete();
}
@resource
private Myclient myClient;

@RequestMapping("test1")
@responsebody
public Map<String, Object> test1() throws Exception {
myClient.delete();
return null;
}

@2084276225
Copy link

您上边提的问题,属于是框架使用特性决定的不算是一个 BUG,是默认的规约。已经像作者咨询过了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants