{"action":"created","issue":{"url":"https://api.github.com/repos/elixir-lang/plug/issues/292","labels_url":"https://api.github.com/repos/elixir-lang/plug/issues/292/labels{/name}","comments_url":"https://api.github.com/repos/elixir-lang/plug/issues/292/comments","events_url":"https://api.github.com/repos/elixir-lang/plug/issues/292/events","html_url":"https://github.com/elixir-lang/plug/issues/292","id":102910527,"number":292,"title":"Negotiating Content-Encoding is broken (somewhere)","user":{"login":"stevegraham","id":18622,"avatar_url":"https://avatars.githubusercontent.com/u/18622?v=3","gravatar_id":"","url":"https://api.github.com/users/stevegraham","html_url":"https://github.com/stevegraham","followers_url":"https://api.github.com/users/stevegraham/followers","following_url":"https://api.github.com/users/stevegraham/following{/other_user}","gists_url":"https://api.github.com/users/stevegraham/gists{/gist_id}","starred_url":"https://api.github.com/users/stevegraham/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stevegraham/subscriptions","organizations_url":"https://api.github.com/users/stevegraham/orgs","repos_url":"https://api.github.com/users/stevegraham/repos","events_url":"https://api.github.com/users/stevegraham/events{/privacy}","received_events_url":"https://api.github.com/users/stevegraham/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-08-24T23:09:14Z","updated_at":"2015-08-24T23:14:21Z","closed_at":"2015-08-24T23:13:18Z","body":"I'm building a Phoenix application and noticed that some of the routes correctly do content negotiation vis-a-vis encoding, while others do not. I tried the plug hello world with `compress: true` in the handler options.\r\n\r\n```elixir\r\ndefmodule MyPlug do\r\n  import Plug.Conn\r\n\r\n  def init(options) do\r\n    # initialize options\r\n\r\n    options\r\n  end\r\n\r\n  def call(conn, _opts) do\r\n    conn\r\n    |> put_resp_content_type(\"text/plain\")\r\n    |> send_resp(200, \"Hello world\")\r\n  end\r\nend\r\n\r\n{:ok, _} = Plug.Adapters.Cowboy.http MyPlug, [], port: 1234, compress: true\r\n```\r\n\r\nWhen I make a request with the `Accept-Encoding` header set to gzip I should expect the request body to be gzipped and the `Content-Encoding` response header to be set to gzip. However\r\n\r\n```\r\ncurl --compress -v http://0.0.0.0:1234/                                                                                7 ↵\r\n* About to connect() to 0.0.0.0 port 1234 (#0)\r\n*   Trying 0.0.0.0...\r\n* Adding handle: conn: 0x7f9da1003a00\r\n* Adding handle: send: 0\r\n* Adding handle: recv: 0\r\n* Curl_addHandleToPipeline: length: 1\r\n* - Conn 0 (0x7f9da1003a00) send_pipe: 1, recv_pipe: 0\r\n* Connected to 0.0.0.0 (0.0.0.0) port 1234 (#0)\r\n> GET / HTTP/1.1\r\n> User-Agent: curl/7.30.0\r\n> Host: 0.0.0.0:1234\r\n> Accept: */*\r\n> Accept-Encoding: deflate, gzip\r\n> \r\n< HTTP/1.1 200 OK\r\n< connection: keep-alive\r\n* Server Cowboy is not blacklisted\r\n< server: Cowboy\r\n< date: Mon, 24 Aug 2015 22:56:20 GMT\r\n< content-length: 11\r\n< cache-control: max-age=0, private, must-revalidate\r\n< content-type: text/plain; charset=utf-8\r\n< \r\n* Connection #0 to host 0.0.0.0 left intact\r\nHello world%\r\n```\r\n\r\nI have no idea why this is happening, especially as for some routes in my app content negotiation works. Could this be an issue with plug or cowboy?\r\n"},"comment":{"url":"https://api.github.com/repos/elixir-lang/plug/issues/comments/134408349","html_url":"https://github.com/elixir-lang/plug/issues/292#issuecomment-134408349","issue_url":"https://api.github.com/repos/elixir-lang/plug/issues/292","id":134408349,"user":{"login":"stevegraham","id":18622,"avatar_url":"https://avatars.githubusercontent.com/u/18622?v=3","gravatar_id":"","url":"https://api.github.com/users/stevegraham","html_url":"https://github.com/stevegraham","followers_url":"https://api.github.com/users/stevegraham/followers","following_url":"https://api.github.com/users/stevegraham/following{/other_user}","gists_url":"https://api.github.com/users/stevegraham/gists{/gist_id}","starred_url":"https://api.github.com/users/stevegraham/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stevegraham/subscriptions","organizations_url":"https://api.github.com/users/stevegraham/orgs","repos_url":"https://api.github.com/users/stevegraham/repos","events_url":"https://api.github.com/users/stevegraham/events{/privacy}","received_events_url":"https://api.github.com/users/stevegraham/received_events","type":"User","site_admin":false},"created_at":"2015-08-24T23:14:21Z","updated_at":"2015-08-24T23:14:21Z","body":"body length has to be > 300! 😫😖 https://github.com/ninenines/cowboy/blob/b290b88a67204f8ba5be94dda759f0cc2baa18be/src/cowboy_req.erl#L765"}}