From 2e1114c505dd18526fa1a0447afff3a3849780d3 Mon Sep 17 00:00:00 2001 From: Dimitri Sokolyuk Date: Sun, 20 Dec 2015 15:20:41 +0100 Subject: Bikeshading --- client.go | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'client.go') 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 } -- cgit v1.2.3