Skip to content

Commit 020a6eb

Browse files
authored
1 parent d409406 commit 020a6eb

File tree

1 file changed

+30
-5
lines changed
  • tulip-runtime/src/main/java/io/github/wfouche/tulip/user

1 file changed

+30
-5
lines changed

tulip-runtime/src/main/java/io/github/wfouche/tulip/user/HttpUser.java

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
import java.util.HashMap;
66
import org.jetbrains.annotations.NotNull;
7+
import org.springframework.http.HttpMethod;
78
import org.springframework.http.ResponseEntity;
89
import org.springframework.web.client.RestClientException;
910

@@ -41,7 +42,7 @@ public boolean isSuccessful() {
4142
}
4243

4344
/**
44-
* http_GET() method
45+
* httpGet() method
4546
*
4647
* @param uri - uri to invoke
4748
* @param uriVariables - sequence of variables to replace in uri
@@ -61,7 +62,7 @@ public Response httpGet(String uri, Object... uriVariables) throws RestClientExc
6162
}
6263

6364
/**
64-
* http_POST() method
65+
* httpPost() method
6566
*
6667
* @param reqBodyJson - JSON string
6768
* @param uri - uri to invoke
@@ -85,7 +86,7 @@ public Response httpPost(String reqBodyJson, String uri, Object... uriVariables)
8586
}
8687

8788
/**
88-
* http_PUT() method
89+
* httpPut() method
8990
*
9091
* @param reqBodyJson - JSON string
9192
* @param uri - uri to invoke
@@ -109,7 +110,7 @@ public Response httpPut(String reqBodyJson, String uri, Object... uriVariables)
109110
}
110111

111112
/**
112-
* http_PATCH() method
113+
* httpPatch() method
113114
*
114115
* @param reqBodyJson - JSON string
115116
* @param uri - uri to invoke
@@ -133,7 +134,7 @@ public Response httpPatch(String reqBodyJson, String uri, Object... uriVariables
133134
}
134135

135136
/**
136-
* http_DELETE() method
137+
* httpDelete() method
137138
*
138139
* @param uri - uri to invoke
139140
* @param uriVariables - sequence of variables to replace in uri
@@ -152,6 +153,30 @@ public Response httpDelete(String uri, Object... uriVariables) throws RestClient
152153
return new Response(entity.getStatusCode().value(), entity.getBody());
153154
}
154155

156+
/**
157+
* httpQuery() method
158+
*
159+
* @param reqBodyJson - JSON string
160+
* @param uri - uri to invoke
161+
* @param uriVariables - sequence of variables to replace in uri
162+
* @return boolean
163+
* @throws RestClientException - Spring exception
164+
*/
165+
@NotNull
166+
public Response httpQuery(String reqBodyJson, String uri, Object... uriVariables)
167+
throws RestClientException {
168+
ResponseEntity<String> entity =
169+
restClient()
170+
.method(HttpMethod.valueOf("QUERY"))
171+
.uri(uri, uriVariables)
172+
.header(http_header_key, http_header_val)
173+
.contentType(APPLICATION_JSON)
174+
.body(reqBodyJson)
175+
.retrieve()
176+
.toEntity(String.class);
177+
return new Response(entity.getStatusCode().value(), entity.getBody());
178+
}
179+
155180
/**
156181
* getUserParamValue() method
157182
*

0 commit comments

Comments
 (0)