Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add multiple cookies #95

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
10 changes: 10 additions & 0 deletions src/FsHttp/DslCE.fs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
module FsHttp.DslCE

open FsHttp.Domain
open System

// Whatch out: Config.defaultConfig is mutable, so access must be delayed.
let private defaultStartingContext () = { config = Config.defaultConfig }
Expand Down Expand Up @@ -197,6 +198,15 @@ module Header =
[<CustomOperation("CookieForDomain")>]
member this.SetCookieForDomain(builder: LazyHttpBuilder<_>, name, value, path, domain) =
Dsl.Header.cookieForDomain name value path domain builder.Context |> LazyHttpBuilder

/// A collection of HTTP cookies previously sent by the server with 'Set-Cookie' with
/// the subset of URIs on the origin server to which these Cookies apply
[<CustomOperation("Cookies")>]
member this.SetCookieForDomain(builder: LazyHttpBuilder<_>, cookies: string seq) =
for cookie in cookies do
let cookieValues = cookie.Split(";")
let (name, value, path, domain) = cookieValues.[0], cookieValues.[1], cookieValues.[2], cookieValues.[3]
Dsl.Header.cookieForDomain name value path domain builder.Context |> LazyHttpBuilder

/// The date and time that the message was sent
[<CustomOperation("Date")>]
Expand Down