mirror of
https://github.com/gin-gonic/gin.git
synced 2025-10-14 20:22:20 +08:00
comment
This commit is contained in:
parent
c7c51af0ec
commit
cdaceb18a5
@ -979,8 +979,8 @@ func (c *Context) IsWebsocket() bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *Context) requestHeader(key string) string {
|
func (c *Context) requestHeader(key string) string {
|
||||||
c.hmu.Lock()
|
c.hmu.RLock()
|
||||||
defer c.hmu.Unlock()
|
defer c.hmu.RUnlock()
|
||||||
return c.Request.Header.Get(key)
|
return c.Request.Header.Get(key)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,12 +27,13 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/gin-contrib/sse"
|
"github.com/gin-contrib/sse"
|
||||||
"github.com/gin-gonic/gin/binding"
|
|
||||||
"github.com/gin-gonic/gin/codec/json"
|
|
||||||
testdata "github.com/gin-gonic/gin/testdata/protoexample"
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
|
|
||||||
|
"github.com/gin-gonic/gin/binding"
|
||||||
|
"github.com/gin-gonic/gin/codec/json"
|
||||||
|
testdata "github.com/gin-gonic/gin/testdata/protoexample"
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ context.Context = (*Context)(nil)
|
var _ context.Context = (*Context)(nil)
|
||||||
@ -3422,6 +3423,8 @@ func TestContextSetCookieData(t *testing.T) {
|
|||||||
setCookie := c.Writer.Header().Get("Set-Cookie")
|
setCookie := c.Writer.Header().Get("Set-Cookie")
|
||||||
assert.Contains(t, setCookie, "SameSite=None")
|
assert.Contains(t, setCookie, "SameSite=None")
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
|
||||||
func TestParallelHeaderWrite(t *testing.T) {
|
func TestParallelHeaderWrite(t *testing.T) {
|
||||||
c, _ := CreateTestContext(httptest.NewRecorder())
|
c, _ := CreateTestContext(httptest.NewRecorder())
|
||||||
wg := sync.WaitGroup{}
|
wg := sync.WaitGroup{}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user