mirror of
https://github.com/gin-gonic/gin.git
synced 2025-10-16 13:22:09 +08:00
refactor switch to if statement
This commit is contained in:
parent
40b983805d
commit
45a17535e9
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user