Skip to content

Commit 5205072

Browse files
committed
修改文档
1 parent bfc00ff commit 5205072

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,32 @@
11
# ws-http.java
22
A tiny lib for java httpclient to my girlfriend.
3+
4+
```java
5+
// Issues a GET to Google
6+
Response httpResponse = new Request("http://example.com")
7+
.getResource();
8+
9+
String responseBody = httpResponse.getBody();
10+
11+
//
12+
Response httpResponse = new Request("http://example.com")
13+
.addHeader("x-my-header", "foobar")
14+
.addQueryParameter("foo", "bar")
15+
.getResource();
16+
17+
String responseBody = httpResponse.getBody();
18+
19+
// Posts a simple JSON object to the server
20+
Response httpResponse = new Request("http://example.com")
21+
.addHeader("x-my-header", "foobar")
22+
.addQueryParameter("foo", "bar")
23+
.setBody("{foo: 'bar'}")
24+
.postResource();
25+
26+
String responseBody = httpResponse.getBody();
27+
28+
```
29+
30+
### Problems
31+
32+
- cannot support https

0 commit comments

Comments
 (0)