Skip to content

Commit 482bb54

Browse files
committed
Update README.md
Added addHeader() description
1 parent d8ae555 commit 482bb54

File tree

1 file changed

+24
-18
lines changed

1 file changed

+24
-18
lines changed

README.md

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,30 @@ How to
1111
Install the library by [downloading the latest release](https://github.com/runemadsen/HTTProcessing/releases) or via the [Processing contribution manager](http://wiki.processing.org/w/How_to_Install_a_Contributed_Library).
1212

1313
Then import the library in your sketch:
14-
15-
import http.requests.*;
16-
14+
```Java
15+
import http.requests.*;
16+
```
1717
Then you can make GET and POST requests from your code:
18-
19-
GetRequest get = new GetRequest("http://httprocessing.heroku.com");
20-
get.send();
21-
println("Reponse Content: " + get.getContent());
22-
println("Reponse Content-Length Header: " + get.getHeader("Content-Length"));
18+
```Java
19+
GetRequest get = new GetRequest("http://httprocessing.heroku.com");
20+
get.send();
21+
println("Reponse Content: " + get.getContent());
22+
println("Reponse Content-Length Header: " + get.getHeader("Content-Length"));
2323

24-
PostRequest post = new PostRequest("http://httprocessing.heroku.com");
25-
post.addData("name", "Rune");
26-
post.send();
27-
println("Reponse Content: " + post.getContent());
28-
println("Reponse Content-Length Header: " + post.getHeader("Content-Length"));
29-
24+
PostRequest post = new PostRequest("http://httprocessing.heroku.com");
25+
post.addData("name", "Rune");
26+
post.send();
27+
println("Reponse Content: " + post.getContent());
28+
println("Reponse Content-Length Header: " + post.getHeader("Content-Length"));
29+
```
3030
To authenticate requests using a Basic Access authentication scheme, include the following in your requests:
31-
32-
get.addUser("username", "password");
33-
34-
post.addUser("username", "password");
31+
```Java
32+
get.addUser("username", "password");
33+
post.addUser("username", "password");
34+
```
35+
To add a header to your request, including the following:
36+
```Java
37+
//method: addHeader(name,value)
38+
get.addHeader("Accept", "application/json");
39+
post.addHeader("Content-Type", "application/json");
40+
```

0 commit comments

Comments
 (0)