[akka-user] Re: Akka Http Client - User-Agent header

2015-01-21 Thread Grzegorz Wilkowicz
Hi,

What about other custom headers: X-Forwarded-For, SOAPAction, etc? How can 
I add them to the request?

W dniu czwartek, 8 stycznia 2015 09:26:11 UTC+1 użytkownik André napisał:

 Hi Marcin,

 the user agent string is a config property and configured here 
 https://github.com/akka/akka/blob/release-2.3-dev/akka-http-core/src/main/resources/reference.conf#L69-L73
 .

 Cheers
 André

 On Wednesday, January 7, 2015 9:14:23 PM UTC+1, Marcin Gosk wrote:

 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(sToken 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 akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.


[akka-user] Re: Akka Http Client - User-Agent header

2015-01-21 Thread André
The RequestBuilding trait is currently only used in tests.

you can use the methods on HttpMessage with RawHeaders instead:

HttpRequest(GET, /some/address.json)
  .withHeaders(
RawHeader(X-Forwarded-For, ...),
RawHeader(SOAPAction, ...),
...)

On Wednesday, January 21, 2015 at 12:51:24 PM UTC+1, Grzegorz Wilkowicz 
wrote:

 Hi,

 What about other custom headers: X-Forwarded-For, SOAPAction, etc? How can 
 I add them to the request?

 W dniu czwartek, 8 stycznia 2015 09:26:11 UTC+1 użytkownik André napisał:

 Hi Marcin,

 the user agent string is a config property and configured here 
 https://github.com/akka/akka/blob/release-2.3-dev/akka-http-core/src/main/resources/reference.conf#L69-L73
 .

 Cheers
 André

 On Wednesday, January 7, 2015 9:14:23 PM UTC+1, Marcin Gosk wrote:

 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(sToken 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 akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.


[akka-user] Re: Akka Http Client - User-Agent header

2015-01-21 Thread Grzegorz Wilkowicz
Thanks.

W dniu środa, 21 stycznia 2015 13:18:37 UTC+1 użytkownik André napisał:

 The RequestBuilding trait is currently only used in tests.

 you can use the methods on HttpMessage with RawHeaders instead:

 HttpRequest(GET, /some/address.json)
   .withHeaders(
 RawHeader(X-Forwarded-For, ...),
 RawHeader(SOAPAction, ...),
 ...)

 On Wednesday, January 21, 2015 at 12:51:24 PM UTC+1, Grzegorz Wilkowicz 
 wrote:

 Hi,

 What about other custom headers: X-Forwarded-For, SOAPAction, etc? How 
 can I add them to the request?

 W dniu czwartek, 8 stycznia 2015 09:26:11 UTC+1 użytkownik André napisał:

 Hi Marcin,

 the user agent string is a config property and configured here 
 https://github.com/akka/akka/blob/release-2.3-dev/akka-http-core/src/main/resources/reference.conf#L69-L73
 .

 Cheers
 André

 On Wednesday, January 7, 2015 9:14:23 PM UTC+1, Marcin Gosk wrote:

 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(sToken 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 akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.


[akka-user] Re: Akka Http Client - User-Agent header

2015-01-08 Thread André
Hi Marcin,

the user agent string is a config property and configured here 
https://github.com/akka/akka/blob/release-2.3-dev/akka-http-core/src/main/resources/reference.conf#L69-L73
.

Cheers
André

On Wednesday, January 7, 2015 9:14:23 PM UTC+1, Marcin Gosk wrote:

 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(sToken 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 akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.