{"action":"created","issue":{"url":"https://api.github.com/repos/akka/akka-http/issues/356","repository_url":"https://api.github.com/repos/akka/akka-http","labels_url":"https://api.github.com/repos/akka/akka-http/issues/356/labels{/name}","comments_url":"https://api.github.com/repos/akka/akka-http/issues/356/comments","events_url":"https://api.github.com/repos/akka/akka-http/issues/356/events","html_url":"https://github.com/akka/akka-http/issues/356","id":179251126,"number":356,"title":"`DELETE` method with Accept:application/json header fails with `NotAcceptable` but still get underlying function called","user":{"login":"stremlenye","id":586343,"avatar_url":"https://avatars.githubusercontent.com/u/586343?v=3","gravatar_id":"","url":"https://api.github.com/users/stremlenye","html_url":"https://github.com/stremlenye","followers_url":"https://api.github.com/users/stremlenye/followers","following_url":"https://api.github.com/users/stremlenye/following{/other_user}","gists_url":"https://api.github.com/users/stremlenye/gists{/gist_id}","starred_url":"https://api.github.com/users/stremlenye/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stremlenye/subscriptions","organizations_url":"https://api.github.com/users/stremlenye/orgs","repos_url":"https://api.github.com/users/stremlenye/repos","events_url":"https://api.github.com/users/stremlenye/events{/privacy}","received_events_url":"https://api.github.com/users/stremlenye/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-09-26T14:53:03Z","updated_at":"2016-09-26T15:57:24Z","closed_at":null,"body":"Hi\r\n\r\nto enclose the problem I've wrote that test you see here:\r\n\r\n```scala\r\nimplicit val actorSystem = ActorSystem()\r\n    implicit val materializer = ActorMaterializer(ActorMaterializerSettings(actorSystem))\r\n    var triggered = false\r\n    val route =\r\n      path(\"blah\") {\r\n        delete {\r\n          complete {\r\n            triggered = true\r\n            StatusCodes.OK\r\n          }\r\n        }\r\n      }\r\n\r\n    Await.ready(Http().bindAndHandle(route, \"0.0.0.0\", 11022), 10 seconds)\r\n\r\n    val request = HttpRequest(HttpMethods.DELETE, Uri(\"http://localhost:11022/blah\"), immutable.Seq[HttpHeader](Accept(MediaRange(MediaTypes.`application/json`))))\r\n    val result = Await.result(Http().singleRequest(request), 10 seconds)\r\n\r\n    assert(result.status == StatusCodes.NotAcceptable)\r\n    assert(triggered == false)\r\n\r\n    actorSystem.terminate()\r\n```\r\n\r\nThe test is failing, and according to the [RFC-2616](https://www.w3.org/Protocols/rfc2616/rfc2616.txt) thats not 100% clear is that behaviour is a strainght forward or not, but it feels wrong to receive and error and get endpoint to be triggered at the same time."},"comment":{"url":"https://api.github.com/repos/akka/akka-http/issues/comments/249613043","html_url":"https://github.com/akka/akka-http/issues/356#issuecomment-249613043","issue_url":"https://api.github.com/repos/akka/akka-http/issues/356","id":249613043,"user":{"login":"jrudolph","id":9868,"avatar_url":"https://avatars.githubusercontent.com/u/9868?v=3","gravatar_id":"","url":"https://api.github.com/users/jrudolph","html_url":"https://github.com/jrudolph","followers_url":"https://api.github.com/users/jrudolph/followers","following_url":"https://api.github.com/users/jrudolph/following{/other_user}","gists_url":"https://api.github.com/users/jrudolph/gists{/gist_id}","starred_url":"https://api.github.com/users/jrudolph/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jrudolph/subscriptions","organizations_url":"https://api.github.com/users/jrudolph/orgs","repos_url":"https://api.github.com/users/jrudolph/repos","events_url":"https://api.github.com/users/jrudolph/events{/privacy}","received_events_url":"https://api.github.com/users/jrudolph/received_events","type":"User","site_admin":false},"created_at":"2016-09-26T15:57:24Z","updated_at":"2016-09-26T15:57:24Z","body":"Yes, basically. The predefined marshaller for status codes ([source](https://github.com/akka/akka-http/blob/master/akka-http/src/main/scala/akka/http/scaladsl/marshalling/PredefinedToResponseMarshallers.scala#L33)) creates a `text/plain` response including the \"default message\" for that status code as the entity. This will be rejected with `NotAcceptable` if the client expects an `application/json` response, instead. You can use `complete(HttpResponse(StatusCodes.OK))` to stay clear of such problems."}}
{"actor":{"display_login":"jrudolph"}}