I have this post request and have two issues.
1.is with the headers
value. The documentation says it takes in a Seq[HttpHeader]
and I pass in a Seq[RawHeader]
which extends HttpHeader
but it says it's a type mismatch. Why?
2.I pass in the data I want to post, but the HttpEntity.Default()
takes in a Source[Bytestring]
. How do I convert my data
to Source[Bytestring]
def post(data: String): Unit = {
val headers = Seq(RawHeader("X-Access-Token", "access token"))
val responseFuture: Future[HttpResponse] =
Http(system).singleRequest(
HttpRequest(
HttpMethods.POST,
"https://beta-legacy-api.ojointernal.com/centaur/user",
headers,
entity = HttpEntity.Default(data)
)
)
}