Commit bad853a1 authored by Leon's avatar Leon Committed by David Venhoek

Server emits specific error in case the requests's Content-Type is not properly set

parent 3d1f7cde
......@@ -312,9 +312,12 @@ func (s *Server) handleCreate(w http.ResponseWriter, r *http.Request) {
return
}
if !applies {
s.conf.Logger.Warnf("Session request uses unknown authentication method, HTTP headers: %s, HTTP POST body: %s",
server.ToJson(r.Header), string(body))
server.WriteError(w, server.ErrorInvalidRequest, "Request could not be authorized")
if r.Header.Get("Content-Type") != "application/json" {
server.WriteError(w, server.ErrorInvalidRequest, "Content-Type is not \"application/json\"")
return
}
s.conf.Logger.Warnf("Session request uses unknown authentication method, HTTP headers: %s, HTTP POST body: %s", server.ToJson(r.Header), string(body))
server.WriteError(w, server.ErrorInvalidRequest, "Request could not be authenticated")
return
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment