|
30 | 30 | import java.net.URISyntaxException; |
31 | 31 | import java.net.URLEncoder; |
32 | 32 |
|
| 33 | +import java.nio.charset.Charset; |
33 | 34 | import java.util.HashMap; |
34 | 35 | import java.util.List; |
35 | 36 | import java.util.Map; |
@@ -206,13 +207,9 @@ public Response post(Request request) throws URISyntaxException, IOException { |
206 | 207 | } |
207 | 208 | } |
208 | 209 |
|
209 | | - try { |
210 | | - httpPost.setEntity(new StringEntity(request.body)); |
211 | | - if (request.body != "") { |
212 | | - httpPost.setHeader("Content-Type", "application/json"); |
213 | | - } |
214 | | - } catch (IOException ex) { |
215 | | - throw ex; |
| 210 | + httpPost.setEntity(new StringEntity(request.body, Charset.forName("UTF-8"))); |
| 211 | + if (request.body != "") { |
| 212 | + httpPost.setHeader("Content-Type", "application/json"); |
216 | 213 | } |
217 | 214 |
|
218 | 215 | try { |
@@ -252,13 +249,9 @@ public Response patch(Request request) throws URISyntaxException, IOException { |
252 | 249 | } |
253 | 250 | } |
254 | 251 |
|
255 | | - try { |
256 | | - httpPatch.setEntity(new StringEntity(request.body)); |
257 | | - if (request.body != "") { |
258 | | - httpPatch.setHeader("Content-Type", "application/json"); |
259 | | - } |
260 | | - } catch (IOException ex) { |
261 | | - throw ex; |
| 252 | + httpPatch.setEntity(new StringEntity(request.body, Charset.forName("UTF-8"))); |
| 253 | + if (request.body != "") { |
| 254 | + httpPatch.setHeader("Content-Type", "application/json"); |
262 | 255 | } |
263 | 256 |
|
264 | 257 | try { |
@@ -299,13 +292,9 @@ public Response put(Request request) throws URISyntaxException, IOException { |
299 | 292 | } |
300 | 293 |
|
301 | 294 |
|
302 | | - try { |
303 | | - httpPut.setEntity(new StringEntity(request.body)); |
304 | | - if (request.body != "") { |
305 | | - httpPut.setHeader("Content-Type", "application/json"); |
306 | | - } |
307 | | - } catch (IOException ex) { |
308 | | - throw ex; |
| 295 | + httpPut.setEntity(new StringEntity(request.body, Charset.forName("UTF-8"))); |
| 296 | + if (request.body != "") { |
| 297 | + httpPut.setHeader("Content-Type", "application/json"); |
309 | 298 | } |
310 | 299 |
|
311 | 300 | try { |
@@ -345,13 +334,9 @@ public Response delete(Request request) throws URISyntaxException, IOException { |
345 | 334 | } |
346 | 335 | } |
347 | 336 |
|
348 | | - try { |
349 | | - httpDelete.setEntity(new StringEntity(request.body)); |
350 | | - if (request.body != "") { |
351 | | - httpDelete.setHeader("Content-Type", "application/json"); |
352 | | - } |
353 | | - } catch (IOException ex) { |
354 | | - throw ex; |
| 337 | + httpDelete.setEntity(new StringEntity(request.body, Charset.forName("UTF-8"))); |
| 338 | + if (request.body != "") { |
| 339 | + httpDelete.setHeader("Content-Type", "application/json"); |
355 | 340 | } |
356 | 341 |
|
357 | 342 | try { |
|
0 commit comments