Skip to content

Commit

Permalink
try github testing - wrong comment character...
Browse files Browse the repository at this point in the history
  • Loading branch information
alessandro benassi trenta committed Dec 23, 2023
1 parent 2680ac4 commit 786c2f9
Showing 1 changed file with 2 additions and 29 deletions.
31 changes: 2 additions & 29 deletions x-real-ip-overwriter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import (
"net/http/httptest"
"testing"

# "github.com/aless3/x-real-ip-overwrite"
// "github.com/aless3/x-real-ip-overwrite"
)

# no changes
// no changes
func TestDemoNoCF(t *testing.T) {
cfg := x_real_ip_overwrite.CreateConfig()

Check failure on line 14 in x-real-ip-overwriter_test.go

View workflow job for this annotation

GitHub Actions / Go (1.19, ubuntu-latest)

undefined: x_real_ip_overwrite

Check failure on line 14 in x-real-ip-overwriter_test.go

View workflow job for this annotation

GitHub Actions / Go (1.19, macos-latest)

undefined: x_real_ip_overwrite

Check failure on line 14 in x-real-ip-overwriter_test.go

View workflow job for this annotation

GitHub Actions / Go (1.x, ubuntu-latest)

undefined: x_real_ip_overwrite

Check failure on line 14 in x-real-ip-overwriter_test.go

View workflow job for this annotation

GitHub Actions / Go (1.x, macos-latest)

undefined: x_real_ip_overwrite

Expand All @@ -34,33 +34,6 @@ func TestDemoNoCF(t *testing.T) {
assertHeader(t, req, "X-Real-IP", "127.0.0.1")
}

# # apply changes
# func TestDemoNoCF(t *testing.T) {
# cfg := x_real_ip_overwrite.CreateConfig()

# ctx := context.Background()
# next := http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) {})

# handler, err := x-real-ip-overwrite.New(ctx, next, cfg, "x-real-ip-overwrite")
# if err != nil {
# t.Fatal(err)
# }

# recorder := httptest.NewRecorder()

# req, err := http.NewRequestWithContext(ctx, http.MethodGet, "http://localhost", nil)
# if err != nil {
# t.Fatal(err)
# }

# req.Headers["X-Real-IP"] = "127.0.0.1"
# req.Headers["CF-Connecting-IP"] = "192.168.0.0"
# handler.ServeHTTP(recorder, req)

# assertHeader(t, req, "X-Real-IP", "192.168.0.0")
# assertHeader(t, req, "X-Real-IP-overwritten", "127.0.0.1")
# }


func assertHeader(t *testing.T, req *http.Request, key, expected string) {
t.Helper()
Expand Down

0 comments on commit 786c2f9

Please sign in to comment.