Skip to content

Commit

Permalink
refactor switch to if statement
Browse files Browse the repository at this point in the history
  • Loading branch information
Bisstocuz committed Oct 21, 2021
1 parent 40b9838 commit 45a1753
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions context.go
Original file line number Diff line number Diff line change
Expand Up @@ -740,10 +740,7 @@ func (c *Context) ShouldBindBodyWith(obj interface{}, bb binding.BindingBody) (e
// the remote IP (coming form Request.RemoteAddr) is returned.
func (c *Context) ClientIP() string {
// Check if we're running on a trusted platform, continue running backwards if error
switch c.engine.TrustedPlatform {
case "":
// TrustedPlatform is empty, do nothing
default:
if c.engine.TrustedPlatform != "" {
// Developers can define their own header of Trusted Platform or use predefined constants
if addr := c.requestHeader(c.engine.TrustedPlatform); addr != "" {
return addr
Expand Down

0 comments on commit 45a1753

Please sign in to comment.