![JAR search and dependency download from the Maven repository](/logo.png)
endpoints4s.sttp.client.JsonEntitiesFromCodecs.scala Maven / Gradle / Ivy
package endpoints4s.sttp.client
/** Interpreter for [[endpoints4s.algebra.JsonEntitiesFromCodecs]] that encodes JSON request
*
* @group interpreters
*/
trait JsonEntitiesFromCodecs[R[_]] extends endpoints4s.algebra.JsonEntitiesFromCodecs {
self: EndpointsWithCustomErrors[R] =>
def jsonRequest[A](implicit codec: JsonCodec[A]): RequestEntity[A] = { (a, req) =>
req.body(stringCodec(codec).encode(a)).contentType("application/json")
}
def jsonResponse[A](implicit codec: JsonCodec[A]): ResponseEntity[A] =
stringCodecResponse(stringCodec(codec))
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy