So here is my code:
post((name :: stringBody) :+: headerOption[String]("AMI-WS-Header")) { (body: String, amiHeader: String) =>
val response: HttpResponse[String] = Http(url + name).headers(
if (name == "login") Map("Content-Type" -> "application/json")
else Map("Content-Type" -> "application/json", "AMI-WS-Header" -> amiHeader)
).postData(body).asString
Ok(parse(response body).right.get)
As you can see, I'm trying to get a specific header along with the body of the request. However it gives me the following error:
Error:(32, 9) overloaded method value apply with alternatives:
(input: io.finch.Input)io.finch.Endpoint.Result[String :+: Option[String] :+: shapeless.CNil] <and>
(mapper: io.finch.syntax.Mapper[String :+: Option[String] :+: shapeless.CNil])io.finch.Endpoint[mapper.Out]
cannot be applied to ((String, String) => io.finch.Output[io.circe.Json])
post((name :: stringBody) :+: headerOption("AMI-WS-Header")) { (body: String, amiHeader: String) =>
I've searched a lot for a solution but haven't come across anything so far.
What is the right way to get a specific header value from the post request?