{"action":"created","issue":{"url":"https://api.github.com/repos/yegor256/takes/issues/490","labels_url":"https://api.github.com/repos/yegor256/takes/issues/490/labels{/name}","comments_url":"https://api.github.com/repos/yegor256/takes/issues/490/comments","events_url":"https://api.github.com/repos/yegor256/takes/issues/490/events","html_url":"https://github.com/yegor256/takes/issues/490","id":124224454,"number":490,"title":"Refactoring of RqHeaders","user":{"login":"exper0","id":7703204,"avatar_url":"https://avatars.githubusercontent.com/u/7703204?v=3","gravatar_id":"","url":"https://api.github.com/users/exper0","html_url":"https://github.com/exper0","followers_url":"https://api.github.com/users/exper0/followers","following_url":"https://api.github.com/users/exper0/following{/other_user}","gists_url":"https://api.github.com/users/exper0/gists{/gist_id}","starred_url":"https://api.github.com/users/exper0/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/exper0/subscriptions","organizations_url":"https://api.github.com/users/exper0/orgs","repos_url":"https://api.github.com/users/exper0/repos","events_url":"https://api.github.com/users/exper0/events{/privacy}","received_events_url":"https://api.github.com/users/exper0/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-12-29T15:18:48Z","updated_at":"2016-01-05T14:09:48Z","closed_at":null,"body":"Currently RqHeaders has following methods to work with HTTP headers:\r\n\r\n    /**\r\n     * Get single header.\r\n     *\r\n     * @param key Header name\r\n     * @return List of values (can be empty)\r\n     * @throws IOException If fails\r\n     */\r\n    Iterable<String> header(CharSequence key) throws IOException;\r\n\r\n    /**\r\n     * Get all header names.\r\n     *\r\n     * @return All names\r\n     * @throws IOException If fails\r\n     */\r\n    Iterable<String> names() throws IOException;\r\n\r\n\r\nHowever, working with Iterables not really convenient. Example: in order to check if some header exists I have to write something like this:\r\n\r\n    new RqHeaders.Base(req)\r\n                        .header(header)\r\n                        .iterator()\r\n                        .hasNext();\r\n\r\nNot very clear and obvious. \r\nAt the same time internally RqHeaders implementations contain a kind of multimap - header name to list of values. I think it would be useful to have a couple of additional methods:\r\n\r\n    Set<String> namesSet();\r\n    List<String> getHeader(String header);\r\n\r\nAlso, RqHeaders.Base implementation contains Map<String, List<String>> - probably it would be cleaner to replace it with library multimap implementation, e.g. ListMultimap<String,String> from guava"},"comment":{"url":"https://api.github.com/repos/yegor256/takes/issues/comments/169010513","html_url":"https://github.com/yegor256/takes/issues/490#issuecomment-169010513","issue_url":"https://api.github.com/repos/yegor256/takes/issues/490","id":169010513,"user":{"login":"yegor256","id":526301,"avatar_url":"https://avatars.githubusercontent.com/u/526301?v=3","gravatar_id":"","url":"https://api.github.com/users/yegor256","html_url":"https://github.com/yegor256","followers_url":"https://api.github.com/users/yegor256/followers","following_url":"https://api.github.com/users/yegor256/following{/other_user}","gists_url":"https://api.github.com/users/yegor256/gists{/gist_id}","starred_url":"https://api.github.com/users/yegor256/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yegor256/subscriptions","organizations_url":"https://api.github.com/users/yegor256/orgs","repos_url":"https://api.github.com/users/yegor256/repos","events_url":"https://api.github.com/users/yegor256/events{/privacy}","received_events_url":"https://api.github.com/users/yegor256/received_events","type":"User","site_admin":false},"created_at":"2016-01-05T14:09:48Z","updated_at":"2016-01-05T14:09:48Z","body":"@exper0 OK, I agree, let's use `Set` and `List` in `header()` and `names()` respectively. Other ideas, about multi-map, please submit in separate tickets. We are trying to use one ticket per problem."}}