Skip to content

Commit

Permalink
If no Accept header field is present, then it is assumed that the cli…
Browse files Browse the repository at this point in the history
…ent accepts all media types. (RFC 2616)
  • Loading branch information
julienrf committed Nov 17, 2012
1 parent ba571ef commit 136e235
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion framework/src/play/src/main/scala/play/api/mvc/Http.scala
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,10 @@ package play.api.mvc {
* @return true if `mediaType` matches the Accept header, otherwise false
*/
def accepts(mediaType: String): Boolean = {
accept.contains(mediaType) || accept.contains("*/*") || accept.contains(mediaType.takeWhile(_ != '/') + "/*")
accept.isEmpty ||
accept.contains(mediaType) ||
accept.contains("*/*") ||
accept.contains(mediaType.takeWhile(_ != '/') + "/*")
}

/**
Expand Down

0 comments on commit 136e235

Please sign in to comment.