aboutsummaryrefslogtreecommitdiff
path: root/client.go
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2015-12-18 00:38:36 +0100
committerDimitri Sokolyuk <demon@dim13.org>2015-12-18 00:38:36 +0100
commit9afc7bda5c1ce76ade2bfd0c91e1bd1cbbceeb44 (patch)
tree581c40157ac8c402b9b7cbf306916327e580711c /client.go
parent2b6bb06811197142d1b0ae53127a37f76e36589a (diff)
409
Diffstat (limited to 'client.go')
-rw-r--r--client.go14
1 files changed, 10 insertions, 4 deletions
diff --git a/client.go b/client.go
index 83dcf57..0b6a892 100644
--- a/client.go
+++ b/client.go
@@ -88,14 +88,14 @@ func (c *Client) post(url string, s Signer, v interface{}) error {
}
defer resp.Body.Close()
- if resp.StatusCode >= http.StatusBadRequest {
- return handleError(resp)
- }
-
c.nonce <- replyNonce(resp)
c.Link = links(resp)
c.Location = location(resp)
+ if resp.StatusCode >= http.StatusBadRequest {
+ return handleError(resp)
+ }
+
body, err = ioutil.ReadAll(resp.Body)
if err != nil {
return err
@@ -173,6 +173,12 @@ func (c *Client) Agree(a *Account) (*Registration, error) {
return r, err
}
+func (c *Client) Query(a *Account) (*Registration, error) {
+ r := &Registration{Resource: ResRegister}
+ err := c.post(c.Location, a, r)
+ return r, err
+}
+
func (c *Client) Authorize(a *Account, domain string) (*Authorization, error) {
r := &Authorization{
Resource: ResNewAuthz,