mirror of https://github.com/gin-gonic/gin.git
Compare commits
2 Commits
a9ea3b4b00
...
562bd95b5b
Author | SHA1 | Date |
---|---|---|
Saksham Arya | 562bd95b5b | |
Saksham Arya | b5e8b10371 |
|
@ -27,11 +27,12 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/gin-contrib/sse"
|
||||
"github.com/gin-gonic/gin/binding"
|
||||
testdata "github.com/gin-gonic/gin/testdata/protoexample"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"google.golang.org/protobuf/proto"
|
||||
|
||||
"github.com/gin-gonic/gin/binding"
|
||||
testdata "github.com/gin-gonic/gin/testdata/protoexample"
|
||||
)
|
||||
|
||||
var _ context.Context = (*Context)(nil)
|
||||
|
@ -3123,3 +3124,23 @@ func TestContextNext(t *testing.T) {
|
|||
assert.True(t, exists)
|
||||
assert.Equal(t, "value3", value)
|
||||
}
|
||||
|
||||
func TestParallelHeaderWrite(t *testing.T) {
|
||||
c, _ := CreateTestContext(httptest.NewRecorder())
|
||||
wg := sync.WaitGroup{}
|
||||
wg.Add(1)
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
for i := 0; i < 1000; i++ {
|
||||
c.Header("key", "value")
|
||||
}
|
||||
}()
|
||||
wg.Add(1)
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
for i := 0; i < 1000; i++ {
|
||||
c.Header("key", "value")
|
||||
}
|
||||
}()
|
||||
wg.Wait()
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue