Merge pull request #74 from loelkes/master

Make the response from the client auth backend OCS compliant
This commit is contained in:
Joachim Bauch 2021-01-07 09:26:46 +01:00 committed by GitHub
commit fd96d4e506
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 17 additions and 1 deletions

View File

@ -209,6 +209,9 @@ func (c *SignalingClient) processMessage(message *signaling.ServerMessage) {
case "bye":
log.Printf("Received bye: %+v\n", message.Bye)
c.Close()
case "error":
log.Printf("Received error: %+v\n", message.Error)
c.Close()
default:
log.Printf("Unsupported message type: %+v\n", *message)
}
@ -453,9 +456,22 @@ func registerAuthHandler(router *mux.Router) {
return
}
rawdata := json.RawMessage(data)
payload := &signaling.OcsResponse{
Ocs: &signaling.OcsBody{
Data: &rawdata,
},
}
jsonpayload, err := payload.MarshalJSON()
if err != nil {
log.Println(err)
return
}
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(http.StatusOK)
w.Write(data)
w.Write(jsonpayload)
})
}