簡體   English   中英

REST 保證不記錄響應正文

[英]REST Assured don't log response body

我有方法:

<https://uri:8080/getVer>

此方法返回有關應用程序版本的信息。 像那樣:

1.39.1

它是文本,不是 xml,不是 json,不是 html。

當我嘗試在 REST 中使用此方法時保證:

        RestAssured.given()
            .log().uri()
            .baseUri("https://uri:8080/")
            .relaxedHTTPSValidation()
            .get("getVer")
            .then()
            .log().all();

我沒有收到響應正文:

來自進程的日志:

 Request URI: https://uri:8080/getVer HTTP/1.1 200 Content-Length: 6 X-Flow-Trace-Id: someTraceId Content-Type: application/json;charset=UTF-8 Date: Thu, 30 Dec 2021 19:27:03 GMT Set-Cookie: some_cookie; path=/; Httponly; Secure Server: some app server Process finished with exit code 0

為什么我沒有收到響應正文? 當我嘗試在瀏覽器上將 go 指向此鏈接時,我收到了一個值。

這是 Postman 的一個例子

嘗試這個:

RestAssured.given()
            .log().uri()
            .baseUri("https://uri:8080/")
            .relaxedHTTPSValidation()
            .get("getVer")
            .then()
            .log().all()
            .extract()
            .response();

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM