Giraffe icon indicating copy to clipboard operation
Giraffe copied to clipboard

setContentType function

Open Choc13 opened this issue 4 years ago • 0 comments

I've found myself searching for a setContentType function, like setStatusCode that is just a functional version of the SetStatusCode extension method on HttpContext.

I couldn't find this one, am I right in thinking it doesn't exist?

If not would you be happy for me open a PR to add it to Core.fs alongside setStatusCode?

I believe the implementation is just

let setContentType contentType : HttpHandler =
    fun next ctx ->
        ctx.SetContentType contentType
        next ctx

Choc13 avatar Jun 06 '21 16:06 Choc13