Registrar.ResolveAccountByKey: Fix issues found testing with Pebble (#1142)
This commit is contained in:
parent
e5d4dd166d
commit
0714fcf679
2 changed files with 3 additions and 15 deletions
|
@ -156,15 +156,10 @@ func (r *Registrar) ResolveAccountByKey() (*Resource, error) {
|
|||
log.Infof("acme: Trying to resolve account by key")
|
||||
|
||||
accMsg := acme.Account{OnlyReturnExisting: true}
|
||||
accountTransit, err := r.core.Accounts.New(accMsg)
|
||||
account, err := r.core.Accounts.New(accMsg)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
account, err := r.core.Accounts.Get(accountTransit.Location)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &Resource{URI: accountTransit.Location, Body: account}, nil
|
||||
return &Resource{URI: account.Location, Body: account.Account}, nil
|
||||
}
|
||||
|
|
|
@ -18,14 +18,7 @@ func TestRegistrar_ResolveAccountByKey(t *testing.T) {
|
|||
defer tearDown()
|
||||
|
||||
mux.HandleFunc("/account", func(w http.ResponseWriter, _ *http.Request) {
|
||||
w.Header().Set("Location", apiURL+"/account_recovery")
|
||||
_, err := w.Write([]byte("{}"))
|
||||
if err != nil {
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
})
|
||||
|
||||
mux.HandleFunc("/account_recovery", func(w http.ResponseWriter, _ *http.Request) {
|
||||
w.Header().Set("Location", apiURL+"/account")
|
||||
err := tester.WriteJSONResponse(w, acme.Account{
|
||||
Status: "valid",
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue