0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

spray-clientでBASIC認証

0
Last updated at Posted at 2015-05-08

spray-clientでBASIC認証のかかっているサーバにアクセスする。
ひらたく言えば、sendReceiveする前にBASIC認証のヘッダを加えればよい。

addCredentialsという関数で加えられる。

var pipeline = addCredentials(BasicHttpCredentials("bob", "secret")) 
~> sendReceive

~> 演算子は RequestTransformerを結合できるようだ。

sendReceveは非常にHTTPアクセスするシンプルな関数な模様。
spray.http.HttpRequest -> scala.concurrent.Future[spray.http.HttpResponse な関数。
RequestをいれるとResPonseがでてくる的な。

あとは GET とか POST とかで HttpRequest を作成してpipelineに渡してあげたら実際のリクエストが発生するようだ。

pipeline(Get("/"))

正直なんとなくしかわかっていない。

参考

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?