File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change 1
1
# ws-http.java
2
2
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
You can’t perform that action at this time.
0 commit comments