鉴于此 api文档,我将如何使用 HTTPBuilder 和 Groovy 来构建我的查询?我已经尝试了很多事情,但我没有做对。
def http = new HTTPBuilder()
http.request('http://artifactory:8888/libs-snapshot-local/my/jar/1.0/test-jar-1.0.jar', PUT, JSON ) { req ->
body = [
uri: "http://artifactory:8888/libs-snapshot-local/my/jar/1.0/test-jar-1.0.jar",
downloadUri: "http://artifactory:8888/libs-snapshot-local/my/jar/1.0/test-jar-1.0.jar",
repo: "libs-snapshot-local",
path: "c:\\pathtojarfile\\test.jar",
created: "2012-02-03T08:37:12.599-0800",
createdBy: "someuser",
size: "1024",
mimeType: "application/java-archive"
]
response.success = { resp, json ->
}
}
这似乎让我走到了那里,但它上传了一个空的 jar 文件。似乎身体被完全忽略了。删除它会产生相同的结果。我似乎无法找到有关如何完成此操作的良好参考。