【发布时间】:2023-03-15 05:28:01
【问题描述】:
我收到此错误“java.util.zip.ZipException:未知压缩方法”,但我正在处理 API 放心。会不会和 pom.xml 中的依赖有关?
我用谷歌搜索了这个问题,发现它是关于 zip 文件的,但正如你所见,没有 zip 编码。
这是我的代码和 pom.xml:
@Test
public void trelloCallTest() {
String key = "mykey";
String token = "mytoken";
Response response = given()
.spec(new RequestSpecBuilder().setBaseUri("https://api.trello.com/1").build())
.contentType(ContentType.JSON)
.log().all()
.when()
.queryParams("key", key,
"token",
token,
"name", "myname")
.post("/boards/");
String jsonString = response.asString();
System.out.println(jsonString);
response.then().statusCode(200);
}
这是我的 pom.xml:
<dependencies>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.5.2</version>
</dependency>
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>rest-assured</artifactId>
<version>4.3.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.googlecode.json-simple/json-
simple -->
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>1.1.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.google.code.gson/gson -->
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.6</version>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20210307</version>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>2.4.5</version>
</dependency>
</dependencies>
【问题讨论】:
-
从您的代码中,您有
post("/boards/")- 我没有发现您尝试执行 developer.atlassian.com/cloud/trello/rest/api-group-boards 的方式对板子支持发布请求 -
您好,这是整个请求:api.trello.com/1/boards/…"
标签: java api rest-assured rest-assured-jsonpath