Skip to content

Instantly share code, notes, and snippets.

@alexanderfefelov
Created March 17, 2015 06:09
Show Gist options
  • Save alexanderfefelov/ed50ab81e2b74a8c0ab2 to your computer and use it in GitHub Desktop.
Save alexanderfefelov/ed50ab81e2b74a8c0ab2 to your computer and use it in GitHub Desktop.
"GNU Terry Pratchett" Filter for Play Framework (Scala)
object TerryPratchett extends EssentialFilter {
def apply(nextFilter: EssentialAction) = new EssentialAction {
def apply(requestHeader: RequestHeader) = {
nextFilter(requestHeader).map { result =>
// https://www.reddit.com/r/discworld/comments/2yt9j6/gnu_terry_pratchett
result.withHeaders("X-Clacks-Overhead" -> "GNU Terry Pratchett")
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment