{"action":"created","issue":{"url":"https://api.github.com/repos/pedestal/pedestal/issues/554","repository_url":"https://api.github.com/repos/pedestal/pedestal","labels_url":"https://api.github.com/repos/pedestal/pedestal/issues/554/labels{/name}","comments_url":"https://api.github.com/repos/pedestal/pedestal/issues/554/comments","events_url":"https://api.github.com/repos/pedestal/pedestal/issues/554/events","html_url":"https://github.com/pedestal/pedestal/issues/554","id":319241177,"number":554,"title":"Correctly handle nil values in :headers map when using io.pedestal.test/response-for","user":{"login":"kennyjwilli","id":2453976,"avatar_url":"https://avatars3.githubusercontent.com/u/2453976?v=4","gravatar_id":"","url":"https://api.github.com/users/kennyjwilli","html_url":"https://github.com/kennyjwilli","followers_url":"https://api.github.com/users/kennyjwilli/followers","following_url":"https://api.github.com/users/kennyjwilli/following{/other_user}","gists_url":"https://api.github.com/users/kennyjwilli/gists{/gist_id}","starred_url":"https://api.github.com/users/kennyjwilli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kennyjwilli/subscriptions","organizations_url":"https://api.github.com/users/kennyjwilli/orgs","repos_url":"https://api.github.com/users/kennyjwilli/repos","events_url":"https://api.github.com/users/kennyjwilli/events{/privacy}","received_events_url":"https://api.github.com/users/kennyjwilli/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-05-01T16:00:17Z","updated_at":"2018-05-01T16:48:43Z","closed_at":null,"author_association":"NONE","body":"# Description\r\nCalling `response-for` with `nil` as a header value will result in an exception being logged as an ERROR. The error message is not thrown in the REPL. Additionally, an incorrect response map is returned.\r\n\r\n## Expected Behavior\r\n`nil` values in the `:headers` map are handled gracefully with no exception thrown. The correct response map is returned.\r\n\r\n## Actual Behavior\r\n[This exception](https://pastebin.com/P6A0Pm9S) is thrown in the logs when called with a nil header value (see below steps). Also an incorrect response map is returned: \r\n\r\n```clojure\r\n{:status nil, :body \"\", :headers nil}\r\n```\r\n\r\n## Steps to reproduce\r\n\r\n```clojure\r\n(io.pedestal.test/response-for\r\n  service-fn\r\n  :post \"/my-route\"\r\n  :headers {\"cookie\" nil})\r\n=> {:status nil, :body \"\", :headers nil}\r\n```\r\n\r\nThis exception is caused by the elements array passed to `String/join` being `null` [here](https://github.com/pedestal/pedestal/blob/e9230c3a49b7036b195267c7c24b0c4881c941b5/service/src/io/pedestal/http/request.clj#L27). `(enumeration-seq (.getHeaders servlet-req key))` is null.\r\n\r\n## Pedestal version\r\n`[io.pedestal/pedestal.service \"0.5.3\"]`"},"comment":{"url":"https://api.github.com/repos/pedestal/pedestal/issues/comments/385721080","html_url":"https://github.com/pedestal/pedestal/issues/554#issuecomment-385721080","issue_url":"https://api.github.com/repos/pedestal/pedestal/issues/554","id":385721080,"user":{"login":"kennyjwilli","id":2453976,"avatar_url":"https://avatars3.githubusercontent.com/u/2453976?v=4","gravatar_id":"","url":"https://api.github.com/users/kennyjwilli","html_url":"https://github.com/kennyjwilli","followers_url":"https://api.github.com/users/kennyjwilli/followers","following_url":"https://api.github.com/users/kennyjwilli/following{/other_user}","gists_url":"https://api.github.com/users/kennyjwilli/gists{/gist_id}","starred_url":"https://api.github.com/users/kennyjwilli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kennyjwilli/subscriptions","organizations_url":"https://api.github.com/users/kennyjwilli/orgs","repos_url":"https://api.github.com/users/kennyjwilli/repos","events_url":"https://api.github.com/users/kennyjwilli/events{/privacy}","received_events_url":"https://api.github.com/users/kennyjwilli/received_events","type":"User","site_admin":false},"created_at":"2018-05-01T16:48:43Z","updated_at":"2018-05-01T16:48:43Z","author_association":"NONE","body":"Given that it does not conform to the Ring Spec, I'd also expect an exception to be thrown. The exception linked above is rather obtuse, however; it's not at all clear that the issue is because my `:headers` map contains a `nil` value. I think a better approach would be to throw as soon as we know the `:headers` map does not pass the spec, rather than throwing when `String/join` is passed `nil`. "}}
{"actor":{"display_login":"kennyjwilli"}}