From b0aa5a6da8f5426e83c9fb8be0d7c344e40c3363 Mon Sep 17 00:00:00 2001 From: Dimitri Sokolyuk Date: Sat, 12 Dec 2015 22:10:09 +0100 Subject: kiss --- client.go | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-) (limited to 'client.go') diff --git a/client.go b/client.go index 8efa32c..e2d8492 100644 --- a/client.go +++ b/client.go @@ -146,22 +146,18 @@ func replyNonce(r *http.Response) string { challenge cert-chain */ -func (c *Client) Register(a *Account) error { +func (c *Client) Register(a *Account) (RegistrationResp, error) { rq := Registration{ Resource: ResNewReg, Contact: a.Contact, } re := RegistrationResp{} err := c.request(c.Dir.NewReg, a, rq, &re) - if err != nil { - return err - } - log.Println(re) - return err + return re, err } // Agree to TOS -func (c *Client) Agree(a *Account) error { +func (c *Client) Agree(a *Account) (RegistrationResp, error) { rq := Registration{ Resource: ResRegister, Contact: a.Contact, @@ -169,14 +165,10 @@ func (c *Client) Agree(a *Account) error { } re := RegistrationResp{} err := c.request(c.Location, a, rq, &re) - if err != nil { - return err - } - log.Println(re) - return err + return re, err } -func (c *Client) Authorize(a *Account, domain string) error { +func (c *Client) Authorize(a *Account, domain string) (AuthorizationResp, error) { rq := Authorization{ Resource: ResNewAuthz, Identifier: Identifier{ @@ -186,9 +178,5 @@ func (c *Client) Authorize(a *Account, domain string) error { } re := AuthorizationResp{} err := c.request(c.Dir.NewAuthz, a, rq, &re) - if err != nil { - return err - } - log.Println(re) - return err + return re, err } -- cgit v1.2.3