{"action":"created","issue":{"url":"https://api.github.com/repos/twitter/finagle/issues/374","labels_url":"https://api.github.com/repos/twitter/finagle/issues/374/labels{/name}","comments_url":"https://api.github.com/repos/twitter/finagle/issues/374/comments","events_url":"https://api.github.com/repos/twitter/finagle/issues/374/events","html_url":"https://github.com/twitter/finagle/issues/374","id":71624879,"number":374,"title":"Http client snippet from quickstart does not work","user":{"login":"note","id":345056,"avatar_url":"https://avatars.githubusercontent.com/u/345056?v=3","gravatar_id":"","url":"https://api.github.com/users/note","html_url":"https://github.com/note","followers_url":"https://api.github.com/users/note/followers","following_url":"https://api.github.com/users/note/following{/other_user}","gists_url":"https://api.github.com/users/note/gists{/gist_id}","starred_url":"https://api.github.com/users/note/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/note/subscriptions","organizations_url":"https://api.github.com/users/note/orgs","repos_url":"https://api.github.com/users/note/repos","events_url":"https://api.github.com/users/note/events{/privacy}","received_events_url":"https://api.github.com/users/note/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":9,"created_at":"2015-04-28T15:39:03Z","updated_at":"2015-04-29T23:05:38Z","closed_at":null,"body":"The following snippet (taken from https://twitter.github.io/finagle/guide/Quickstart.html#using-clients) does not work:\r\n\r\n```\r\nobject Client extends App {\r\n  val client: Service[HttpRequest, HttpResponse] =\r\n    Http.newService(\"www.google.com:80\")\r\n  val request =  new DefaultHttpRequest(\r\n    HttpVersion.HTTP_1_1, HttpMethod.GET, \"/\")\r\n  val response: Future[HttpResponse] = client(request)\r\n  response onSuccess { resp: HttpResponse =>\r\n    println(\"GET success: \" + resp)\r\n  }\r\n  Await.ready(response)\r\n}\r\n```\r\n\r\nDifferent servers response with different non-ok responses. Adding `request.setHeader(\"Host\", \"someDomain.com\")` fixes the problem but it's very astonishing and actually hard to find out - usually you expect code from quickstart to just work.\r\n\r\nIn HTTP 1.1 header `Host` is mandatory so I don't know if docs update is needed or should it be fixed on `DefaultHttpRequest` level."},"comment":{"url":"https://api.github.com/repos/twitter/finagle/issues/comments/97610622","html_url":"https://github.com/twitter/finagle/issues/374#issuecomment-97610622","issue_url":"https://api.github.com/repos/twitter/finagle/issues/374","id":97610622,"user":{"login":"mosesn","id":156562,"avatar_url":"https://avatars.githubusercontent.com/u/156562?v=3","gravatar_id":"","url":"https://api.github.com/users/mosesn","html_url":"https://github.com/mosesn","followers_url":"https://api.github.com/users/mosesn/followers","following_url":"https://api.github.com/users/mosesn/following{/other_user}","gists_url":"https://api.github.com/users/mosesn/gists{/gist_id}","starred_url":"https://api.github.com/users/mosesn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mosesn/subscriptions","organizations_url":"https://api.github.com/users/mosesn/orgs","repos_url":"https://api.github.com/users/mosesn/repos","events_url":"https://api.github.com/users/mosesn/events{/privacy}","received_events_url":"https://api.github.com/users/mosesn/received_events","type":"User","site_admin":false},"created_at":"2015-04-29T23:05:38Z","updated_at":"2015-04-29T23:05:38Z","body":":+1: to high level DSL that addresses these concerns.  Not 100% sure that should be in finagle proper, might be a separate wrapper (finch-like maybe?).  For example, I doubt that it's really all that common that you want to switch between http versions, and then we could require more information at client creation or compilation time."}}