Skip to content

Commit

Permalink
Merge pull request #8 from grupawp/master
Browse files Browse the repository at this point in the history
Options extended for custom http.Client
  • Loading branch information
geoffgarside authored Jul 14, 2016
2 parents 32e4124 + 1dbf75e commit 5c674f0
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ import (

// Client configuration options
type Options struct {
URL *url.URL // URL to the CAS service
Store TicketStore // Custom TicketStore, if nil a MemoryStore will be used
URL *url.URL // URL to the CAS service
Store TicketStore // Custom TicketStore, if nil a MemoryStore will be used
Client *http.Client // Custom http client to allow options for http connections
}

// Client implements the main protocol
Expand All @@ -40,10 +41,17 @@ func NewClient(options *Options) *Client {
tickets = &MemoryStore{}
}

var client *http.Client
if options.Client != nil {
client = options.Client
} else {
client = &http.Client{}
}

return &Client{
url: options.URL,
tickets: tickets,
client: &http.Client{},
client: client,
sessions: make(map[string]string),
}
}
Expand Down

0 comments on commit 5c674f0

Please sign in to comment.