Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/SwaggerProvider.DesignTime/OperationCompiler.fs
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ type OperationCompiler(schema: OpenApiDocument, defCompiler: DefinitionCompiler,
let cookieHeader =
%cookies
|> Seq.filter(snd >> isNull >> not)
|> Seq.map(fun (name, value) -> String.Format("{0}={1}", name, value))
|> Seq.map(fun (name, value) -> $"{name}={value}")
|> String.concat ";"

("Cookie", cookieHeader) :: (%headers)
Expand Down
8 changes: 5 additions & 3 deletions src/SwaggerProvider.Runtime/RuntimeHelpers.fs
Original file line number Diff line number Diff line change
Expand Up @@ -212,12 +212,15 @@ module RuntimeHelpers =
| :? DateTimeOffset as dto -> dto.ToString("O")
| null -> null
// Fast paths for the most common scalar param types:
// these avoid calling GetType() and the four subsequent type checks
// these avoid calling GetType() and the subsequent type checks
// (FullName twice, IsGenericType, IsEnum) that follow in the generic branch.
| :? string as s -> s
| :? int32 as i -> i.ToString()
| :? int64 as i -> i.ToString()
| :? bool as b -> b.ToString()
| :? float32 as f -> f.ToString()
| :? double as d -> d.ToString()
| :? Guid as g -> g.ToString()
| _ ->
// Hoist GetType() once; previously tryFormatDateOnly and tryFormatTimeOnly
// each called GetType() internally, resulting in up to 3 GetType() calls for
Expand Down Expand Up @@ -575,8 +578,7 @@ module RuntimeHelpers =
|> Seq.filter(snd >> isNull >> not)
|> Seq.iter(fun (name, value) ->
if not <| msg.Headers.TryAddWithoutValidation(name, value) then
let errMsg =
String.Format("Cannot add header '{0}'='{1}' to HttpRequestMessage", name, value)
let errMsg = $"Cannot add header '{name}'='{value}' to HttpRequestMessage"

if (name <> "Content-Type") then
raise <| Exception(errMsg))
Expand Down
Loading