我有一个 cURL,它需要一个文件校验和和 xml 以及多个标题,以便将图像上传到服务器。我对 RestAssured 不是很熟悉,所以我的问题是;我如何表示 RestAssured 中的 -F cURL 值?
`curl -s -w "\nHTTP %{http_code}\n" -X POST ${mediaUrl}/api/user/${LCID}/repository/${REPO_NAME}/file?conflictSolve=copy \
-H "Accept: application/vnd.******.dv-1.19+xml" \
-H "Content-Type: multipart/form-data" \
-H "Authorization: *** token=\"${TOKEN}\"; authVersion=\"1.0\"" \
-H "x-******-***: ${TOKEN}" \
-H "X-Client-Identifier: TEST" \
-H "X-Client-Platform: CURL" \
-H "x-ingest-tag:RI" \
-F "files=@${XML};type=application/vnd.******.dv-1.19+xml" \
-F "${checksum}=@${file};type=${mimeType}"`
目前我已经取得了唯一的标题。
Response response = given()
.log().all()
.spec(RestUtilities.get**RequestSpecification())
.header("Accept","application/vnd.******.dv-1.19+xml")
.header("Content-Type", "multipart/form-data")
.header("Authorization", "*** token=\""+access_token+"\"; authVersion=\"1.0\";")
.header("x-*****-***", "access_token")
.when()
.post()
.then()
.log().all()
.statusCode(200)
.extract()
.response();
}
}