...

Source file src/edge-infra.dev/pkg/edge/api/middleware/request/ip_test.go

Documentation: edge-infra.dev/pkg/edge/api/middleware/request

     1  package request
     2  
     3  import (
     4  	"context"
     5  	"testing"
     6  
     7  	"github.com/stretchr/testify/assert"
     8  )
     9  
    10  const (
    11  	ipAddress = "50.28.147.253"
    12  )
    13  
    14  func TestFromContext(t *testing.T) {
    15  	ctx := context.WithValue(context.Background(), IPCtxKey{}, ipAddress)
    16  	val := FromContext(ctx, IPCtxKey{})
    17  	assert.Equal(t, ipAddress, val)
    18  }
    19  

View as plain text