NewConnectionTo creates a new connection with the given useragent string and a base URL derived from the hostURL argument.
(hostURL string)
| 60 | // NewConnectionTo creates a new connection with the given useragent string |
| 61 | // and a base URL derived from the hostURL argument. |
| 62 | func NewConnectionTo(hostURL string) *Connection { |
| 63 | defaultHeader := http.Header{ |
| 64 | "Accept": []string{api.MediaTypeBSUP}, |
| 65 | "Content-Type": []string{api.MediaTypeBSUP}, |
| 66 | } |
| 67 | return &Connection{ |
| 68 | client: &http.Client{}, |
| 69 | defaultHeader: defaultHeader, |
| 70 | hostURL: strings.TrimRight(hostURL, "/"), |
| 71 | } |
| 72 | } |
| 73 | |
| 74 | // ClientHostURL allows us to print the host in log messages and internal error messages |
| 75 | func (c *Connection) ClientHostURL() string { |
no outgoing calls