Last active
November 9, 2018 12:52
-
-
Save porfirion/9d295f695481538eb9acf688010377c4 to your computer and use it in GitHub Desktop.
Setting http headers under f# (fsharp)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resp.Content.Headers.ContentType <- MediaTypeHeaderValue.Parse "application/json" | |
// OR | |
resp.Content.Headers.Remove("Content-Type") |> ignore | |
resp.Content.Headers.Add("Content-Type", "application/json") | |
// Because Content-Type header has HttpHeaderKind.Content and there is an exception while setting | |
// it on response itself: | |
// resp.Headers.Add("Content-Type", "application/json") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment