{"action":"opened","issue":{"url":"https://api.github.com/repos/akka/akka/issues/17680","labels_url":"https://api.github.com/repos/akka/akka/issues/17680/labels{/name}","comments_url":"https://api.github.com/repos/akka/akka/issues/17680/comments","events_url":"https://api.github.com/repos/akka/akka/issues/17680/events","html_url":"https://github.com/akka/akka/issues/17680","id":85904500,"number":17680,"title":"[akka-http] Allow directive for matching on HttpEntity type or extracting content-length","user":{"login":"mhamrah","id":91162,"avatar_url":"https://avatars.githubusercontent.com/u/91162?v=3","gravatar_id":"","url":"https://api.github.com/users/mhamrah","html_url":"https://github.com/mhamrah","followers_url":"https://api.github.com/users/mhamrah/followers","following_url":"https://api.github.com/users/mhamrah/following{/other_user}","gists_url":"https://api.github.com/users/mhamrah/gists{/gist_id}","starred_url":"https://api.github.com/users/mhamrah/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mhamrah/subscriptions","organizations_url":"https://api.github.com/users/mhamrah/orgs","repos_url":"https://api.github.com/users/mhamrah/repos","events_url":"https://api.github.com/users/mhamrah/events{/privacy}","received_events_url":"https://api.github.com/users/mhamrah/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-06-07T13:52:13Z","updated_at":"2015-06-07T13:52:13Z","closed_at":null,"body":"I'd like to create a directive that matches when the request.entity is of type HttpEntity.Default. Specifically, I'd like to know when the Content-Length header is set and extract the Content-Length header value.\r\n\r\nContent-length does not appear in request.headers (which seems like a bug), but is only set as a property of the http entity property, depending on the type of entity, and not all entities have a Content-Length property (maybe Content-Length could be an Option[Long] on the HttpEntity trait?\r\n\r\nHere are some other ideas:\r\n\r\n* Filtering on Content-Length being set in a header in a route\r\n* Calling extractRequest, but only if the request.entity is of HttpEntity.Default\r\n* Adding a directive matching on HttpEntity.Default.\r\n* Making contentLength Option[Long]\r\n\r\nOriginally from https://groups.google.com/forum/#!searchin/akka-user/hamrah/akka-user/8LnoBrRPDz4/sOKFDJv9o40J"}}