mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2024-12-23 02:32:12 +00:00
[bugfix] Parse POST-style forms in the list member removal endpoint (#1903)
This commit is contained in:
parent
70357a770f
commit
73bfb5fbff
|
@ -100,7 +100,17 @@ func (m *Module) ListAccountsDELETEHandler(c *gin.Context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
form := &apimodel.ListAccountsChangeRequest{}
|
form := &apimodel.ListAccountsChangeRequest{}
|
||||||
if err := c.ShouldBind(form); err != nil {
|
|
||||||
|
// XXX: Sending a body with a DELETE request is undefined. Ruby on Rails parses
|
||||||
|
// it fine. Go's (*http.Request).ParseForm only parses POST-style forms for POST,
|
||||||
|
// PUT, and PATCH request methods. Change the method until we're done with
|
||||||
|
// parsing in order to be compatible with Mastodon's client API conventions.
|
||||||
|
oldMethod := c.Request.Method
|
||||||
|
c.Request.Method = "POST"
|
||||||
|
err = c.ShouldBind(form)
|
||||||
|
c.Request.Method = oldMethod
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
apiutil.ErrorHandler(c, gtserror.NewErrorBadRequest(err, err.Error()), m.processor.InstanceGetV1)
|
apiutil.ErrorHandler(c, gtserror.NewErrorBadRequest(err, err.Error()), m.processor.InstanceGetV1)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue