You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by pa...@apache.org on 2023/06/21 05:39:26 UTC
[groovy-release] branch master updated: add delete http helper method
This is an automated email from the ASF dual-hosted git repository.
paulk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/groovy-release.git
The following commit(s) were added to refs/heads/master by this push:
new c2b52cc add delete http helper method
c2b52cc is described below
commit c2b52cc873bd9beccb74efd212ac50b59a72a223
Author: Paul King <pa...@asert.com.au>
AuthorDate: Wed Jun 21 15:39:17 2023 +1000
add delete http helper method
---
buildSrc/src/main/groovy/HttpUtil.groovy | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/buildSrc/src/main/groovy/HttpUtil.groovy b/buildSrc/src/main/groovy/HttpUtil.groovy
index 9bcf16b..471af6d 100644
--- a/buildSrc/src/main/groovy/HttpUtil.groovy
+++ b/buildSrc/src/main/groovy/HttpUtil.groovy
@@ -47,6 +47,15 @@ class HttpUtil {
.build()
}
+ static HttpRequest deleteRequest(url, user, password) {
+ HttpRequest.newBuilder()
+ .uri(new URI(url))
+ .header('Authorization', 'Basic ' + "$user:$password".getBytes('iso-8859-1').encodeBase64())
+ .header('Content-Type', 'application/json')
+ .DELETE()
+ .build()
+ }
+
static HttpRequest postRequest(url, String json, user, password) {
def body = HttpRequest.BodyPublishers.ofString(json)
HttpRequest.newBuilder()