diff options
author | Bjørn Madsen <bm@aeons.dk> | 2017-08-09 22:17:53 +0200 |
---|---|---|
committer | Bjørn Madsen <bm@aeons.dk> | 2017-08-09 22:17:53 +0200 |
commit | 85f93f2ccd282cdfceda8ae76cdf3cbb36d20883 (patch) | |
tree | f656e434375c0515051f30eab6f09406d1c759b5 /akka-http-handler | |
parent | 18db8e9d1ee240d11b558cdb9b5c850c5b063080 (diff) | |
download | sttp-85f93f2ccd282cdfceda8ae76cdf3cbb36d20883.tar.gz sttp-85f93f2ccd282cdfceda8ae76cdf3cbb36d20883.tar.bz2 sttp-85f93f2ccd282cdfceda8ae76cdf3cbb36d20883.zip |
Move default content type to BasicRequestBody
Revert BodySerializer to be a function, and remove SerializableBody
Diffstat (limited to 'akka-http-handler')
-rw-r--r-- | akka-http-handler/src/main/scala/com/softwaremill/sttp/akkahttp/AkkaHttpSttpHandler.scala | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/akka-http-handler/src/main/scala/com/softwaremill/sttp/akkahttp/AkkaHttpSttpHandler.scala b/akka-http-handler/src/main/scala/com/softwaremill/sttp/akkahttp/AkkaHttpSttpHandler.scala index 0a2a467..d1dcc22 100644 --- a/akka-http-handler/src/main/scala/com/softwaremill/sttp/akkahttp/AkkaHttpSttpHandler.scala +++ b/akka-http-handler/src/main/scala/com/softwaremill/sttp/akkahttp/AkkaHttpSttpHandler.scala @@ -132,20 +132,19 @@ class AkkaHttpSttpHandler private (actorSystem: ActorSystem, getContentTypeOrOctetStream(r).map { ct => def doSet(body: RequestBody[S]): HttpRequest = body match { case NoBody => ar - case StringBody(b, encoding) => + case StringBody(b, encoding, _) => val ctWithEncoding = HttpCharsets .getForKey(encoding) .map(hc => ContentType.apply(ct.mediaType, () => hc)) .getOrElse(ct) ar.withEntity(ctWithEncoding, b.getBytes(encoding)) - case ByteArrayBody(b) => ar.withEntity(b) - case ByteBufferBody(b) => ar.withEntity(ByteString(b)) - case InputStreamBody(b) => + case ByteArrayBody(b, _) => ar.withEntity(b) + case ByteBufferBody(b, _) => ar.withEntity(ByteString(b)) + case InputStreamBody(b, _) => ar.withEntity( HttpEntity(ct, StreamConverters.fromInputStream(() => b))) - case PathBody(b) => ar.withEntity(ct, b) - case StreamBody(s) => ar.withEntity(HttpEntity(ct, s)) - case SerializableBody(f, t) => doSet(f(t)) + case PathBody(b, _) => ar.withEntity(ct, b) + case StreamBody(s) => ar.withEntity(HttpEntity(ct, s)) } doSet(body) |