Skip to content

Instantly share code, notes, and snippets.

@derekwyatt
Created June 14, 2013 15:47
Show Gist options
  • Save derekwyatt/5782883 to your computer and use it in GitHub Desktop.
Save derekwyatt/5782883 to your computer and use it in GitHub Desktop.
The 'around' directive for spray
def around[A](before: RequestContext => (RequestContext, A))(after: A => HttpResponse => HttpResponse): Directive0 =
mapRequestContext { ctx =>
val (newCtx, a) = before(ctx)
newCtx.withHttpResponseMapped(after(a))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment