forked from httptoolkit/httpsnippet
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfull.java
More file actions
21 lines (19 loc) · 678 Bytes
/
full.java
File metadata and controls
21 lines (19 loc) · 678 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
RestClient restClient = RestClient.create();
MultiValueMap<String, String> formDataMap = new LinkedMultiValueMap<>();
formDataMap.add("foo", "bar");
ResponseEntity<String> response = restClient
.method(HttpMethod.POST)
.uri("http://mockbin.com/har", uriBuilder -> {
uriBuilder.queryParam("foo", "bar");
uriBuilder.queryParam("foo", "baz");
uriBuilder.queryParam("baz", "abc");
uriBuilder.queryParam("key", "value");
return uriBuilder.build();
})
.cookie("foo", "bar")
.cookie("bar", "baz")
.header("accept", "application/json")
.contentType(MediaType.APPLICATION_FORM_URLENCODED)
.body(formDataMap)
.retrieve()
.toEntity(String.class);