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