首页 > 解决方案 > 我得到了 405 的放心获取请求,但它在邮递员上工作正常

问题描述

在此处输入图像描述

邮递员给了我完美的 200 ok 回复,但是当我写下这段休息代码时,我得到了 405 回复

标签: rest-assured

解决方案


你做错了我的朋友。这就是理想的 Rest-Assured 的使用方式。

Response response = RestAssured.given ()
  .baseUri ("<endPoint>") // The hidden part of the sample you shared.
  .basePath ("/rest/onboarding/profile")
  .contentType (ContentType.JSON)
  .queryParam ("user_id", 11)
  .when ()
  .get ("/load_user_profile");

System.out.println (response.statusCode ());
System.out.println (response.statusLine ());

试试这个示例,让我知道这是否对您有用,是否对我有用。


推荐阅读