1+ // Copyright (C) 2018 The Delphi Team.
2+ // See the LICENCE file distributed with this work for additional
3+ // information regarding copyright ownership.
4+ //
5+ // Licensed under the Apache License, Version 2.0 (the "License");
6+ // you may not use this file except in compliance with the License.
7+ // You may obtain a copy of the License at
8+ //
9+ // http://www.apache.org/licenses/LICENSE-2.0
10+ //
11+ // Unless required by applicable law or agreed to in writing, software
12+ // distributed under the License is distributed on an "AS IS" BASIS,
13+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+ // See the License for the specific language governing permissions and
15+ // limitations under the License.
116package utils
217
318
@@ -7,7 +22,7 @@ import akka.http.scaladsl.model.{HttpEntity, HttpMethods, HttpRequest, HttpRespo
722import akka .stream .{ActorMaterializer , ActorMaterializerSettings }
823import akka .util .ByteString
924
10- import scala .concurrent .{Await , Future }
25+ import scala .concurrent .{Await , ExecutionContext , Future }
1126import scala .concurrent .duration .Duration
1227import scala .util .{Failure , Success , Try }
1328import MediaTypes ._
@@ -19,8 +34,8 @@ import MediaTypes._
1934object BlockingHttpClient {
2035
2136 def doGet (uri : Uri ) : Try [String ] = {
22- implicit val system = ActorSystem ()
23- implicit val executionContext = system.dispatcher
37+ implicit val system : ActorSystem = ActorSystem ()
38+ implicit val executionContext : ExecutionContext = system.dispatcher
2439 implicit val materializer : ActorMaterializer = ActorMaterializer (ActorMaterializerSettings (system))
2540
2641 try {
@@ -41,9 +56,9 @@ object BlockingHttpClient {
4156 }
4257
4358 // data parameter will be """{"name":"Hello"}"""
44- def doPost (uri : Uri , data : String ) = {
45- implicit val system = ActorSystem ()
46- implicit val executionContext = system.dispatcher
59+ def doPost (uri : Uri , data : String ) : Try [ String ] = {
60+ implicit val system : ActorSystem = ActorSystem ()
61+ implicit val executionContext : ExecutionContext = system.dispatcher
4762 implicit val materializer : ActorMaterializer = ActorMaterializer (ActorMaterializerSettings (system))
4863 val bdata = ByteString (data)
4964 try {
0 commit comments