Hey guys, is it possible to set custom header ("User-Agent") for akka
streams
val connection = Http().outgoingConnection("someServer", 443)
val request:HttpRequest = RequestBuilding.Get(s"/some/address.json")
// I want to add header here
// request.addHeader(HttpHeader("User-Agent","Mozilla/4.0 (compatible; MSIE
6.0; Windows NT 5.0)"))
Source.single(request).via(connection.flow).runWith(Sink.head).flatMap {
response =>
response.status match {
case status if status.isSuccess =>
val ticker = Unmarshal(response.entity).to[Ticker]
println(ticker)
ticker
case status =>
println(s"$status error:${response.toString}")
Future.failed(new IOException(s"Token request failed with status
${response.status} and error ${response.entity}"))
}
}
--
>>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>> Check the FAQ:
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
---
You received this message because you are subscribed to the Google Groups "Akka
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.