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:
@ -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*/)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user