所有GET Api电话都失败了404,但发布,放置等工作正常,请放心
我们正在使用RestAssured进行休息层测试。所有得到的apis都失败了: -
java.lang.AssertionError: 1 expectation failed.
Expected status code <200> but was <404>.
但所有post,delete,put等API都运行正常。 以下是get的代码: -
RestAssured.given().
header("Authorization","someToken").
when().
get(BASE_URI + "location/listAll").
then().
statusCode(200);
}catch (Exception numberFormatException) {
numberFormatException.getMessage();
}
以下是有效的帖子代码: -
RestAssured.given().log().all().header("Authorization","someToken")
.accept(MediaType.APPLICATION_JSON).
body(LocationModel).
when().
post(BASE_URI + "location/create").
then().
statusCode(200);
}catch (Exception numberFormatException) {
numberFormatException.getMessage();
}