|
@@ -41,14 +41,11 @@ public class YouAreEll {
|
41
|
41
|
public String MakeURLCall(String mainUrl, String method, String jpayload) {
|
42
|
42
|
String fullUrl = baseUrl + mainUrl;
|
43
|
43
|
Request request = null;
|
44
|
|
-
|
45
|
|
- if (method.equalsIgnoreCase("get")) {
|
|
44
|
+ if (method.equalsIgnoreCase("GET")) {
|
46
|
45
|
request = new Request.Builder()
|
47
|
46
|
.url(fullUrl)
|
48
|
47
|
.build();
|
49
|
48
|
}
|
50
|
|
-
|
51
|
|
-
|
52
|
49
|
if (method.equalsIgnoreCase("POST")) {
|
53
|
50
|
RequestBody body = RequestBody.create(JSON, jpayload);
|
54
|
51
|
request = new Request.Builder()
|
|
@@ -56,7 +53,6 @@ public class YouAreEll {
|
56
|
53
|
.post(body)
|
57
|
54
|
.build();
|
58
|
55
|
}
|
59
|
|
-
|
60
|
56
|
if (method.equalsIgnoreCase("PUT")) {
|
61
|
57
|
RequestBody body = RequestBody.create(JSON, jpayload);
|
62
|
58
|
request = new Request.Builder()
|
|
@@ -64,15 +60,14 @@ public class YouAreEll {
|
64
|
60
|
.put(body)
|
65
|
61
|
.build();
|
66
|
62
|
}
|
67
|
|
-
|
68
|
63
|
if (request != null) {
|
69
|
64
|
try (Response response = client.newCall(request).execute()) {
|
70
|
|
- return response.body().string();
|
71
|
|
- } catch (IOException e) {
|
|
65
|
+ return response.body().toString();
|
|
66
|
+ } catch (Exception e) {
|
72
|
67
|
e.printStackTrace();
|
73
|
68
|
}
|
74
|
69
|
}
|
75
|
|
-
|
76
|
70
|
return "error: bad method " + method;
|
77
|
71
|
}
|
|
72
|
+
|
78
|
73
|
}
|