From 15e60279c12eae22d6804ca094ce5f796daaed2c Mon Sep 17 00:00:00 2001 From: Marvin Bertin Date: Tue, 9 Jan 2018 14:30:15 -0800 Subject: add PUT and PATCH responses to RestService Trait --- src/main/scala/xyz/driver/core/rest/RestService.scala | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/main/scala/xyz/driver/core/rest/RestService.scala b/src/main/scala/xyz/driver/core/rest/RestService.scala index c1d883a..3cb66f9 100644 --- a/src/main/scala/xyz/driver/core/rest/RestService.scala +++ b/src/main/scala/xyz/driver/core/rest/RestService.scala @@ -43,6 +43,18 @@ trait RestService extends Service { protected def postJson(baseUri: Uri, path: String, json: JsValue) = HttpRequest(HttpMethods.POST, endpointUri(baseUri, path), entity = jsonEntity(json)) + protected def put(baseUri: Uri, path: String, httpEntity: RequestEntity) = + HttpRequest(HttpMethods.PUT, endpointUri(baseUri, path), entity = httpEntity) + + protected def putJson(baseUri: Uri, path: String, json: JsValue) = + HttpRequest(HttpMethods.PUT, endpointUri(baseUri, path), entity = jsonEntity(json)) + + protected def patch(baseUri: Uri, path: String, httpEntity: RequestEntity) = + HttpRequest(HttpMethods.PATCH, endpointUri(baseUri, path), entity = httpEntity) + + protected def patchJson(baseUri: Uri, path: String, json: JsValue) = + HttpRequest(HttpMethods.PATCH, endpointUri(baseUri, path), entity = jsonEntity(json)) + protected def delete(baseUri: Uri, path: String) = HttpRequest(HttpMethods.DELETE, endpointUri(baseUri, path)) -- cgit v1.2.3