PR #767 - Checks to see if the request body is nil

Signed-off-by: Maryum Styles <yozamacs@msn.com>
This commit is contained in:
Maryum Styles 2019-08-19 18:12:23 -04:00 committed by Andrew Morgan
parent 7b454bdd27
commit 47edbe0737

View file

@ -46,6 +46,11 @@ func SendMembership(
producer *producers.RoomserverProducer, producer *producers.RoomserverProducer,
) util.JSONResponse { ) util.JSONResponse {
var body threepid.MembershipRequest var body threepid.MembershipRequest
if req.Body == nil {
body = threepid.MembershipRequest{}
req.Body = body
}
if reqErr := httputil.UnmarshalJSONRequest(req, &body); reqErr != nil { if reqErr := httputil.UnmarshalJSONRequest(req, &body); reqErr != nil {
return *reqErr return *reqErr
} }