File tree Expand file tree Collapse file tree 3 files changed +21
-15
lines changed Expand file tree Collapse file tree 3 files changed +21
-15
lines changed Original file line number Diff line number Diff line change @@ -2,12 +2,13 @@ import http.requests.*;
2
2
3
3
public void setup ()
4
4
{
5
- size (400 ,400 );
6
- smooth ();
5
+ size (400 , 400 );
6
+ smooth ();
7
7
8
- PostRequest post = new PostRequest (" http://httprocessing.heroku.com" );
9
- post. addData(" {\" on\" :false}" );
10
- post. send();
11
- System . out. println(" Reponse Content: " + post. getContent());
12
- System . out. println(" Reponse Content-Length Header: " + post. getHeader(" Content-Length" ));
8
+ PostRequest post = new PostRequest (" http://httprocessing.heroku.com" );
9
+ put. addHeader(" Content-Type" , " application/json" );
10
+ post. addData(" {\" on\" :false}" );
11
+ post. send();
12
+ System . out. println(" Reponse Content: " + post. getContent());
13
+ System . out. println(" Reponse Content-Length Header: " + post. getHeader(" Content-Length" ));
13
14
}
Original file line number Diff line number Diff line change @@ -2,12 +2,13 @@ import http.requests.*;
2
2
3
3
public void setup ()
4
4
{
5
- size (400 ,400 );
6
- smooth ();
7
-
8
- PutRequest put = new PutRequest (" http://httprocessing.heroku.com" );
9
- put. addData(" {\" on\" :false}" );
10
- put. send();
11
- System . out. println(" Reponse Content: " + put. getContent());
12
- System . out. println(" Reponse Content-Length Header: " + put. getHeader(" Content-Length" ));
5
+ size (400 , 400 );
6
+ smooth ();
7
+
8
+ PutRequest put = new PutRequest (" http://httprocessing.heroku.com" );
9
+ put. addHeader(" Content-Type" , " application/json" );
10
+ put. addData(" {\" on\" :false}" );
11
+ put. send();
12
+ System . out. println(" Reponse Content: " + put. getContent());
13
+ System . out. println(" Reponse Content-Length Header: " + put. getHeader(" Content-Length" ));
13
14
}
Original file line number Diff line number Diff line change @@ -113,6 +113,10 @@ public void send()
113
113
httpPost .setEntity (mentity );
114
114
}
115
115
116
+ if (stringEntity != null ) {
117
+ httpPut .setEntity (stringEntity );
118
+ }
119
+
116
120
Iterator <BasicNameValuePair > headerIterator = headerPairs .iterator ();
117
121
while (headerIterator .hasNext ()) {
118
122
BasicNameValuePair headerPair = headerIterator .next ();
You can’t perform that action at this time.
0 commit comments