1
0
mirror of https://github.com/aclindsa/moneygo.git synced 2025-07-02 04:18:38 -04:00

Stop using form elements for API

Just send the JSON as the request body
This commit is contained in:
2017-11-13 20:48:19 -05:00
parent 9624f0c5bc
commit 5a6be5a07b
23 changed files with 87 additions and 159 deletions

View File

@ -103,14 +103,8 @@ func NewSession(tx *Tx, r *http.Request, userid int64) (*NewSessionWriter, error
func SessionHandler(r *http.Request, context *Context) ResponseWriterWriter {
if r.Method == "POST" || r.Method == "PUT" {
user_json := r.PostFormValue("user")
if user_json == "" {
return NewError(3 /*Invalid Request*/)
}
user := User{}
err := user.Read(user_json)
if err != nil {
var user User
if err := ReadJSON(r, &user); err != nil {
return NewError(3 /*Invalid Request*/)
}