Commit c13ece86 authored by Sietse Ringers's avatar Sietse Ringers
Browse files

refactor: remove unused parameter from ParseBody helper function

parent ce941c53
......@@ -531,7 +531,7 @@ func LogMiddleware(typ string, opts LogOptions) func(next http.Handler) http.Han
}
}
func ParseBody(w http.ResponseWriter, r *http.Request, input interface{}) error {
func ParseBody(r *http.Request, input interface{}) error {
body, err := ioutil.ReadAll(r.Body)
if err != nil {
Logger.WithField("error", err).Info("Malformed request: could not read request body")
......
......@@ -151,7 +151,7 @@ func (s *Server) handleCommitments(w http.ResponseWriter, r *http.Request) {
// Read keys
var keys []irma.PublicKeyIdentifier
if err := server.ParseBody(w, r, &keys); err != nil {
if err := server.ParseBody(r, &keys); err != nil {
server.WriteError(w, server.ErrorInvalidRequest, err.Error())
return
}
......@@ -211,7 +211,7 @@ func (s *Server) handleResponse(w http.ResponseWriter, r *http.Request) {
// Read challenge
challenge := new(big.Int)
if err := server.ParseBody(w, r, challenge); err != nil {
if err := server.ParseBody(r, challenge); err != nil {
server.WriteError(w, server.ErrorInvalidRequest, err.Error())
return
}
......@@ -283,7 +283,7 @@ func (s *Server) handleValidate(w http.ResponseWriter, r *http.Request) {
func (s *Server) handleVerifyPin(w http.ResponseWriter, r *http.Request) {
// Extract request
var msg irma.KeysharePinMessage
if err := server.ParseBody(w, r, &msg); err != nil {
if err := server.ParseBody(r, &msg); err != nil {
server.WriteError(w, server.ErrorInvalidRequest, err.Error())
return
}
......@@ -368,7 +368,7 @@ func (s *Server) verifyPin(user *User, pin string) (irma.KeysharePinStatus, erro
func (s *Server) handleChangePin(w http.ResponseWriter, r *http.Request) {
// Extract request
var msg irma.KeyshareChangePin
if err := server.ParseBody(w, r, &msg); err != nil {
if err := server.ParseBody(r, &msg); err != nil {
server.WriteError(w, server.ErrorInvalidRequest, err.Error())
return
}
......@@ -434,7 +434,7 @@ func (s *Server) updatePin(user *User, oldPin, newPin string) (irma.KeysharePinS
func (s *Server) handleRegister(w http.ResponseWriter, r *http.Request) {
// Extract request
var msg irma.KeyshareEnrollment
if err := server.ParseBody(w, r, &msg); err != nil {
if err := server.ParseBody(r, &msg); err != nil {
server.WriteError(w, server.ErrorInvalidRequest, err.Error())
return
}
......
......@@ -241,7 +241,7 @@ func (s *Server) handleEmailLogin(w http.ResponseWriter, r *http.Request) {
}
var request emailLoginRequest
if err := server.ParseBody(w, r, &request); err != nil {
if err := server.ParseBody(r, &request); err != nil {
server.WriteError(w, server.ErrorInvalidRequest, err.Error())
return
}
......@@ -262,7 +262,7 @@ func (s *Server) handleEmailLogin(w http.ResponseWriter, r *http.Request) {
func (s *Server) handleGetCandidates(w http.ResponseWriter, r *http.Request) {
var token string
if err := server.ParseBody(w, r, &token); err != nil {
if err := server.ParseBody(r, &token); err != nil {
server.WriteError(w, server.ErrorInvalidRequest, err.Error())
return
}
......@@ -309,7 +309,7 @@ func (s *Server) processTokenLogin(request tokenLoginRequest) (string, error) {
func (s *Server) handleTokenLogin(w http.ResponseWriter, r *http.Request) {
var request tokenLoginRequest
if err := server.ParseBody(w, r, &request); err != nil {
if err := server.ParseBody(r, &request); err != nil {
server.WriteError(w, server.ErrorInvalidRequest, err.Error())
return
}
......@@ -386,7 +386,7 @@ func (s *Server) handleIrmaLogin(w http.ResponseWriter, r *http.Request) {
func (s *Server) handleVerifyEmail(w http.ResponseWriter, r *http.Request) {
var token string
if err := server.ParseBody(w, r, &token); err != nil {
if err := server.ParseBody(r, &token); err != nil {
server.WriteError(w, server.ErrorInvalidRequest, err.Error())
return
}
......@@ -524,7 +524,7 @@ func (s *Server) processRemoveEmail(session *session, email string) error {
func (s *Server) handleRemoveEmail(w http.ResponseWriter, r *http.Request) {
var email string
if err := server.ParseBody(w, r, &email); err != nil {
if err := server.ParseBody(r, &email); err != nil {
server.WriteError(w, server.ErrorInvalidRequest, err.Error())
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