Skip to content

Commit

Permalink
Merge pull request #33 from innFactory/feature/Client
Browse files Browse the repository at this point in the history
Feature/client
  • Loading branch information
MoeQuadrat authored Sep 14, 2022
2 parents 891a437 + 4bf3065 commit d7a6758
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import sbt.Compile
import sbt.Keys.cleanFiles

val releaseVersion = sys.env.getOrElse("TAG", "0.2.3-BETA")
val releaseVersion = sys.env.getOrElse("TAG", "0.2.3-BETA.2")
addCommandAlias("publishSmithy4Play", "smithy4play/publish")
addCommandAlias("publishLocalSmithy4Play", "smithy4play/publishLocal")
addCommandAlias("generateCoverage", "clean; coverage; test; coverageReport")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ import play.api.libs.json.Json
case class RoutingErrorResponse(message: String, errorCode: Option[String])

object RoutingErrorResponse {
implicit val writes = Json.writes[RoutingErrorResponse]
implicit val format = Json.format[RoutingErrorResponse]
}
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ class SmithyPlayEndpoint[F[_] <: ContextRoute[_], Op[
)
}
case None =>
println(request.contentType.getOrElse("application/json"))
request.contentType.getOrElse("application/json") match {
case "application/json" => parseJson(request, metadata)
case _ => parseRaw(request, metadata)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package de.innfactory.smithy4play.client

import de.innfactory.smithy4play.ClientResponse
import de.innfactory.smithy4play.{ ClientResponse, RoutingErrorResponse }
import play.api.libs.json.Json

import scala.concurrent.duration.{ Duration, DurationInt }
import scala.concurrent.{ Await, ExecutionContext, Future }
import scala.concurrent.{ Await, ExecutionContext }

object SmithyPlayTestUtils {

Expand All @@ -30,7 +30,8 @@ object SmithyPlayTestUtils {
}

implicit class EnhancedByteArray(error: Array[Byte]) {
def toErrorString: String = new String(error)
def toErrorString: String = new String(error)
def toErrorResponse: RoutingErrorResponse = Json.parse(error).as[RoutingErrorResponse]
}

}
1 change: 1 addition & 0 deletions smithy4playTest/test/TestControllerTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ class TestControllerTest extends PlaySpec with BaseOneAppPerSuite with FakeAppli
val result = testControllerClient.testWithBlob(pngAsBytes, "image/png").awaitRight

result.statusCode mustBe result.expectedStatusCode
pngAsBytes mustBe result.body.get.body
}
}
}

0 comments on commit d7a6758

Please sign in to comment.