Skip to content

Commit e057176

Browse files
committed
Update README for 1.5 with upper case verbs
1 parent 0eab677 commit e057176

File tree

1 file changed

+21
-17
lines changed

1 file changed

+21
-17
lines changed

README.md

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ A light weight wrapper to the JDK 11+ Java Http Client
1414
<dependency>
1515
<groupId>io.avaje</groupId>
1616
<artifactId>avaje-http-client</artifactId>
17-
<version>1.2</version>
17+
<version>1.5</version>
1818
</dependency>
1919
```
2020

@@ -42,24 +42,25 @@ From HttpClientContext:
4242
- Build the url via path(), matrixParam(), queryParam()
4343
- Optionally set headers(), cookies() etc
4444
- Optionally specify a request body (JSON, form, or raw BodyPublisher)
45-
- Http verbs - get(), post(), put(), delete()
45+
- Http verbs - GET(), POST(), PUT(), PATCH(), DELETE(), HEAD(), TRACE()
4646
- Optionally return response body as a bean, list of beans, or raw
4747

4848
## Examples
4949

5050
GET as String
5151
```java
52-
final HttpResponse<String> hres = clientContext.request()
53-
.path("hello")
54-
.get().asString();
55-
52+
final HttpResponse<String> hres = clientContext.request()
53+
.path("hello")
54+
.GET()
55+
.asString();
5656
```
5757

5858
GET as json to single bean
5959
```java
6060
final HelloDto bean = clientContext.request()
6161
.path("hello/there")
62-
.get().bean(HelloDto.class);
62+
.GET()
63+
.bean(HelloDto.class);
6364
```
6465

6566
POST a bean as json request body
@@ -68,18 +69,19 @@ HelloDto bean = new HelloDto(12, "rob", "other");
6869

6970
final HttpResponse<Void> res = clientContext.request()
7071
.path("hello/savebean")
71-
.body(bean).post()
72+
.body(bean)
73+
.POST()
7274
.asDiscarding();
7375

7476
assertThat(res.statusCode()).isEqualTo(201);
75-
7677
```
7778

7879
GET as json to list of beans
7980
```java
8081
final List<HelloDto> beans = clientContext.request()
8182
.path("hello")
82-
.get().list(HelloDto.class);
83+
.GET()
84+
.list(HelloDto.class);
8385
```
8486

8587
Path
@@ -88,13 +90,15 @@ final HttpResponse<String> res = clientContext.request()
8890
.path("hello")
8991
.path("withMatrix")
9092
.path("2011")
91-
.get().asString();
93+
.GET()
94+
.asString();
9295

9396
// is the same as ...
9497

9598
final HttpResponse<String> res = clientContext.request()
9699
.path("hello/withMatrix/2011")
97-
.get().asString();
100+
.GET()
101+
.asString();
98102
```
99103

100104
MatrixParam
@@ -105,7 +109,7 @@ final HttpResponse<String> httpRes = clientContext.request()
105109
.matrixParam("country", "nz")
106110
.path("foo")
107111
.matrixParam("extra", "banana")
108-
.get().asString();
112+
.GET().asString();
109113
```
110114

111115
QueryParam
@@ -114,7 +118,7 @@ final List<HelloDto> beans = clientContext.request()
114118
.path("hello")
115119
.queryParam("sortBy", "name")
116120
.queryParam("maxCount", "100")
117-
.get().list(HelloDto.class);
121+
.GET().list(HelloDto.class);
118122
```
119123

120124
FormParam
@@ -125,13 +129,13 @@ final HttpResponse<Void> res = clientContext.request()
125129
.formParam("email", "user@foo.com")
126130
.formParam("url", "http://foo.com")
127131
.formParam("startDate", "2020-12-03")
128-
.post()
132+
.POST()
129133
.asDiscarding();
130134

131135
assertThat(res.statusCode()).isEqualTo(201);
132136
```
133137

134-
## Currently NO support for POSTing multipart-form
138+
## Currently, NO support for POSTing multipart-form
135139

136140
## Auth token
137141

@@ -149,7 +153,7 @@ Built in support for obtaining and setting an Authorization token.
149153
.url("https://foo/v2/token")
150154
.header("content-type", "application/json")
151155
.body(authRequestAsJson())
152-
.post()
156+
.POST()
153157
.bean(AuthTokenResponse.class);
154158

155159
Instant validUntil = Instant.now().plusSeconds(res.expires_in).minusSeconds(60);

0 commit comments

Comments
 (0)