mirror of
https://github.com/aclindsa/moneygo.git
synced 2024-10-31 16:00:05 -04:00
Make accounts PUT and POST return the resulting Account object
This commit is contained in:
parent
aedad87d07
commit
449b4ee760
15
accounts.go
15
accounts.go
@ -362,7 +362,13 @@ func AccountHandler(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
WriteSuccess(w)
|
||||
w.WriteHeader(201 /*Created*/)
|
||||
err = account.Write(w)
|
||||
if err != nil {
|
||||
WriteError(w, 999 /*Internal Error*/)
|
||||
log.Print(err)
|
||||
return
|
||||
}
|
||||
} else if r.Method == "GET" {
|
||||
var accountid int64
|
||||
n, err := GetURLPieces(r.URL.Path, "/account/%d", &accountid)
|
||||
@ -438,7 +444,12 @@ func AccountHandler(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
WriteSuccess(w)
|
||||
err = account.Write(w)
|
||||
if err != nil {
|
||||
WriteError(w, 999 /*Internal Error*/)
|
||||
log.Print(err)
|
||||
return
|
||||
}
|
||||
} else if r.Method == "DELETE" {
|
||||
accountid, err := GetURLID(r.URL.Path)
|
||||
if err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user