mirror of
https://github.com/wahyd4/loginsrv.git
synced 2026-08-10 05:18:33 +10:00
go fmt
This commit is contained in:
@@ -235,7 +235,6 @@ func ServerClosed(appName string) {
|
||||
Logger.WithFields(fields).Infof("http server was closed: %v", appName)
|
||||
}
|
||||
|
||||
|
||||
func getRemoteIp(r *http.Request) string {
|
||||
if r.Header.Get("X-Cluster-Client-Ip") != "" {
|
||||
return r.Header.Get("X-Cluster-Client-Ip")
|
||||
|
||||
@@ -4,8 +4,8 @@ import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"github.com/tarent/logrus"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/tarent/logrus"
|
||||
"net/http"
|
||||
"os"
|
||||
"testing"
|
||||
@@ -319,7 +319,7 @@ func Test_Logger_Cacheinfo(t *testing.T) {
|
||||
func Test_Logger_GetRemoteIp1(t *testing.T) {
|
||||
a := assert.New(t)
|
||||
req, _ := http.NewRequest("GET", "test.com", nil)
|
||||
req.Header["X-Cluster-Client-Ip"] = []string {"1234"}
|
||||
req.Header["X-Cluster-Client-Ip"] = []string{"1234"}
|
||||
ret := getRemoteIp(req)
|
||||
a.Equal("1234", ret)
|
||||
}
|
||||
@@ -327,7 +327,7 @@ func Test_Logger_GetRemoteIp1(t *testing.T) {
|
||||
func Test_Logger_GetRemoteIp2(t *testing.T) {
|
||||
a := assert.New(t)
|
||||
req, _ := http.NewRequest("GET", "test.com", nil)
|
||||
req.Header["X-Real-Ip"] = []string {"1234"}
|
||||
req.Header["X-Real-Ip"] = []string{"1234"}
|
||||
ret := getRemoteIp(req)
|
||||
a.Equal("1234", ret)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user