aboutsummaryrefslogtreecommitdiff
path: root/client.go
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2015-12-20 15:20:41 +0100
committerDimitri Sokolyuk <demon@dim13.org>2015-12-20 15:20:41 +0100
commit2e1114c505dd18526fa1a0447afff3a3849780d3 (patch)
tree95e3fe9f3e7207a0acaebf4f46d097d7ecfc705e /client.go
parent4dc75be474f81aa777d0a89051be04ac1d5139f1 (diff)
Bikeshading
Diffstat (limited to 'client.go')
-rw-r--r--client.go14
1 files changed, 8 insertions, 6 deletions
diff --git a/client.go b/client.go
index 0b6a892..6006b86 100644
--- a/client.go
+++ b/client.go
@@ -70,7 +70,7 @@ func (c Client) Nonce() (string, error) {
// request is used for
// new-reg, new-authz, challenge, new-cert
-func (c *Client) post(url string, s Signer, v interface{}) error {
+func (c *Client) post(s Signer, v interface{}) error {
body, err := json.Marshal(v)
if err != nil {
return err
@@ -82,7 +82,7 @@ func (c *Client) post(url string, s Signer, v interface{}) error {
return err
}
- resp, err := http.Post(url, "application/jose+json", signed)
+ resp, err := http.Post(c.Location, "application/jose+json", signed)
if err != nil {
return err
}
@@ -158,7 +158,8 @@ func (c *Client) Register(a *Account) (*Registration, error) {
Resource: ResNewReg,
Contact: a.Contact,
}
- err := c.post(c.Dir.NewReg, a, r)
+ c.Location = c.Dir.NewReg
+ err := c.post(a, r)
return r, err
}
@@ -169,13 +170,13 @@ func (c *Client) Agree(a *Account) (*Registration, error) {
Contact: a.Contact,
Agreement: c.Link["terms-of-service"],
}
- err := c.post(c.Location, a, r)
+ err := c.post(a, r)
return r, err
}
func (c *Client) Query(a *Account) (*Registration, error) {
r := &Registration{Resource: ResRegister}
- err := c.post(c.Location, a, r)
+ err := c.post(a, r)
return r, err
}
@@ -187,7 +188,8 @@ func (c *Client) Authorize(a *Account, domain string) (*Authorization, error) {
Value: domain,
},
}
- err := c.post(c.Dir.NewAuthz, a, r)
+ c.Location = c.Dir.NewAuthz
+ err := c.post(a, r)
return r, err
}