放心:无法确定使用哪个路径实现错误

时间:2019-07-02 13:04:56

标签: rest cucumber rest-assured

尝试提取响应时出现以下错误行:

  

无法确定要使用的路径实现,因为   内容类型应用程序/八位字节流不映射到路径   实施。

响应为:

{
    "status": "ok"
}

显然类似于JSON格式。

因此,我尝试以下操作:

requestSpecification.contentType(ContentType.JSON);

在运行请求之前,

RestAssured.registerParser("application/octet-stream", Parser.JSON);
String acutual_val = response.then().extract().path("status");

之后。

但是我收到上面的错误消息。

请告知。 谢谢!

1 个答案:

答案 0 :(得分:0)

请尝试使用

response.then().extract().jsonPath().get(path);