(t *testing.T, opts *testOptions)
| 379 | func TestCookies_module(t *testing.T) { testCookies(t, nil) } |
| 380 | func TestCookies_worker(t *testing.T) { testCookies(t, &testOptions{workerScript: "cookies.php"}) } |
| 381 | func testCookies(t *testing.T, opts *testOptions) { |
| 382 | runTest(t, func(handler func(http.ResponseWriter, *http.Request), _ *httptest.Server, i int) { |
| 383 | req := httptest.NewRequest("GET", "http://example.com/cookies.php", nil) |
| 384 | req.AddCookie(&http.Cookie{Name: "foo", Value: "bar"}) |
| 385 | req.AddCookie(&http.Cookie{Name: "i", Value: fmt.Sprintf("%d", i)}) |
| 386 | body, _ := testRequest(req, handler, t) |
| 387 | |
| 388 | assert.Contains(t, body, "'foo' => 'bar'") |
| 389 | assert.Contains(t, body, fmt.Sprintf("'i' => '%d'", i)) |
| 390 | }, opts) |
| 391 | } |
| 392 | |
| 393 | func TestMalformedCookie(t *testing.T) { |
| 394 | runTest(t, func(handler func(http.ResponseWriter, *http.Request), _ *httptest.Server, i int) { |
no test coverage detected