Skip to content

Commit

Permalink
JAVACLIENT-221: Add mediatype support to NuxeoClient apis
Browse files Browse the repository at this point in the history
  • Loading branch information
Vladimir Pasquier committed Jun 17, 2021
1 parent ced55c3 commit ca5a7f6
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions nuxeo-java-client/src/main/java/org/nuxeo/client/NuxeoClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,16 @@ public Response post(String url, String json) {
return request(url, builder -> builder.post(body));
}

public Response put(String url, String json, okhttp3.MediaType mediaType) {
RequestBody body = RequestBody.create(mediaType, json);
return request(url, builder -> builder.put(body));
}

public Response post(String url, String json, okhttp3.MediaType mediaType) {
RequestBody body = RequestBody.create(mediaType, json);
return request(url, builder -> builder.post(body));
}

protected Response request(String url, UnaryOperator<Request.Builder> method) {
try {
Request.Builder requestBuilder = new Request.Builder().url(url);
Expand Down

0 comments on commit ca5a7f6

Please sign in to comment.