Skip to content

Commit

Permalink
add slash at the end of request uri
Browse files Browse the repository at this point in the history
the missing of slash symbol invokes `RuntimeError` on PATCH and DEL
request
  • Loading branch information
Tzu-ting committed Nov 1, 2016
1 parent cf1768f commit 5192b42
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions appmate/src/main/java/nctu/fintech/appmate/DbAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ public boolean add(JSONObject item) {
public boolean update(int index, Map<String, String> changes) {
try {
String encodedData = encodeParam(changes);
sendRequest("PATCH", index + "?format=json", ContentType.Form, encodedData, HttpURLConnection.HTTP_OK, false);
sendRequest("PATCH", index + "/?format=json", ContentType.Form, encodedData, HttpURLConnection.HTTP_OK, false);
return true;
} catch (Exception e) {
Log.e(this.getClass().getName(), e.getMessage());
Expand All @@ -231,7 +231,7 @@ public boolean update(int index, Map<String, String> changes) {
*/
public boolean update(int index, JSONObject changes) {
try {
sendRequest("PATCH", index + "?format=json", ContentType.Json, changes.toString(), HttpURLConnection.HTTP_OK, false);
sendRequest("PATCH", index + "/?format=json", ContentType.Json, changes.toString(), HttpURLConnection.HTTP_OK, false);
return true;
} catch (Exception e) {
Log.e(this.getClass().getName(), e.getMessage());
Expand All @@ -247,7 +247,7 @@ public boolean update(int index, JSONObject changes) {
*/
public boolean delete(int index) {
try {
sendRequest("DELETE", index + "?format=json", HttpURLConnection.HTTP_NO_CONTENT, false);
sendRequest("DELETE", index + "/?format=json", HttpURLConnection.HTTP_NO_CONTENT, false);
return true;
} catch (Exception e) {
Log.e(this.getClass().getName(), e.getMessage());
Expand Down

0 comments on commit 5192b42

Please sign in to comment.