Skip to content

Commit 0714fcf

Browse files
authored
Registrar.ResolveAccountByKey: Fix issues found testing with Pebble (#1142)
1 parent e5d4dd1 commit 0714fcf

File tree

2 files changed

+3
-15
lines changed

2 files changed

+3
-15
lines changed

registration/registar.go

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -156,15 +156,10 @@ func (r *Registrar) ResolveAccountByKey() (*Resource, error) {
156156
log.Infof("acme: Trying to resolve account by key")
157157

158158
accMsg := acme.Account{OnlyReturnExisting: true}
159-
accountTransit, err := r.core.Accounts.New(accMsg)
160-
if err != nil {
161-
return nil, err
162-
}
163-
164-
account, err := r.core.Accounts.Get(accountTransit.Location)
159+
account, err := r.core.Accounts.New(accMsg)
165160
if err != nil {
166161
return nil, err
167162
}
168163

169-
return &Resource{URI: accountTransit.Location, Body: account}, nil
164+
return &Resource{URI: account.Location, Body: account.Account}, nil
170165
}

registration/registar_test.go

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,7 @@ func TestRegistrar_ResolveAccountByKey(t *testing.T) {
1818
defer tearDown()
1919

2020
mux.HandleFunc("/account", func(w http.ResponseWriter, _ *http.Request) {
21-
w.Header().Set("Location", apiURL+"/account_recovery")
22-
_, err := w.Write([]byte("{}"))
23-
if err != nil {
24-
http.Error(w, err.Error(), http.StatusInternalServerError)
25-
}
26-
})
27-
28-
mux.HandleFunc("/account_recovery", func(w http.ResponseWriter, _ *http.Request) {
21+
w.Header().Set("Location", apiURL+"/account")
2922
err := tester.WriteJSONResponse(w, acme.Account{
3023
Status: "valid",
3124
})

0 commit comments

Comments
 (0)