Skip to content

Commit

Permalink
session: Remove guard condition from map delete
Browse files Browse the repository at this point in the history
* delete() on a non-existed key in map does not cause any error.
  Remove the guarding conditions.
  • Loading branch information
yookoala committed Oct 13, 2020
1 parent 2b7bad8 commit 28534a1
Showing 1 changed file with 4 additions and 13 deletions.
17 changes: 4 additions & 13 deletions session.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,19 +160,10 @@ func MapRemoteHost(inner SessionHandler) SessionHandler {
// SCRIPT_NAME
func FilterAuthReqParams(inner SessionHandler) SessionHandler {
return func(client Client, req *Request) (*ResponsePipe, error) {
if _, ok := req.Params["CONTENT_LENGTH"]; ok {
delete(req.Params, "CONTENT_LENGTH")
}
if _, ok := req.Params["PATH_INFO"]; ok {
delete(req.Params, "PATH_INFO")
}
if _, ok := req.Params["PATH_TRANSLATED"]; ok {
delete(req.Params, "PATH_TRANSLATED")
}
if _, ok := req.Params["SCRIPT_NAME"]; ok {
delete(req.Params, "SCRIPT_NAME")
}

delete(req.Params, "CONTENT_LENGTH")
delete(req.Params, "PATH_INFO")
delete(req.Params, "PATH_TRANSLATED")
delete(req.Params, "SCRIPT_NAME")
return inner(client, req)
}
}
Expand Down

0 comments on commit 28534a1

Please sign in to comment.