Skip to content

Commit

Permalink
Allow slightly buggy Authorization headers
Browse files Browse the repository at this point in the history
  • Loading branch information
haf committed Jun 7, 2018
1 parent 6776b5d commit 58306bb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
7 changes: 4 additions & 3 deletions HttpFs/HttpFs.fs
Original file line number Diff line number Diff line change
Expand Up @@ -645,8 +645,9 @@ module Client =

/// Sets headers on HttpRequestMessage.
/// Mutates HttpRequestMessage.
let setHeaders (headers : RequestHeader list) (request : HttpRequestMessage) =
let add (k : string) (v: string) = request.Headers.Add (k, v)
let setHeaders (headers: RequestHeader list) (request: HttpRequestMessage) =
let add (k: string) (v: string) = request.Headers.Add (k, v)
let addf (k: string) (v: string) = request.Headers.TryAddWithoutValidation(k, v) |> ignore
// in .NET full, HttpRequestMessage cannot have the Content property with HttpMethods that do not support content, or it fails with an exception,
// so request.Content can be null. this is acutally NOT the case in .NET Core, where it does not throw an exception when content is set with a GET method
let addContent (add: HttpContent -> unit) = if not <| isNull request.Content then add request.Content
Expand All @@ -655,7 +656,7 @@ module Client =
| AcceptCharset value -> add "Accept-Charset" value
| AcceptDatetime value -> add "Accept-Datetime" value
| AcceptLanguage value -> add "Accept-Language" value
| Authorization value -> add "Authorization" value
| Authorization value -> addf "Authorization" value
| RequestHeader.Connection value -> add "Connection" value
| RequestHeader.ContentMD5 value -> addContent (fun c ->
// this is to work around a mono bug.
Expand Down
3 changes: 3 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#### 5.2.1 — 2018-06-07
* Allow adding Authorization header without HttpClient validating it.

#### 5.2.0 — 2018-05-20
* Bump compilation target to net471 due to https://github.com/dotnet/corefx/issues/23306 and so many other errors stemming from this
* Suave.Testing is now a file in each unit test project
Expand Down

0 comments on commit 58306bb

Please sign in to comment.