Skip to content

Commit a295637

Browse files
committed
lint: fix lint
1 parent e871bfc commit a295637

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

encoding_test.go

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package encoding
22

33
import (
44
"bytes"
5+
"context"
56
"errors"
67
"fmt"
78
"io"
@@ -260,7 +261,7 @@ func Test_Encoding_Bind(t *testing.T) {
260261
{
261262
"form - application/x-www-form-urlencoded",
262263
func() (*http.Request, error) {
263-
r, err := http.NewRequest(http.MethodPost, "http://example.com", bytes.NewReader([]byte(`id=foo&name=bar`)))
264+
r, err := http.NewRequestWithContext(context.Background(), http.MethodPost, "http://example.com", bytes.NewReader([]byte(`id=foo&name=bar`)))
264265
if err != nil {
265266
return nil, err
266267
}
@@ -276,7 +277,7 @@ func Test_Encoding_Bind(t *testing.T) {
276277
{
277278
"form - method get so it query",
278279
func() (*http.Request, error) {
279-
r, err := http.NewRequest(http.MethodGet, "http://example.com?id=foo&name=bar", nil)
280+
r, err := http.NewRequestWithContext(context.Background(), http.MethodGet, "http://example.com?id=foo&name=bar", nil)
280281
if err != nil {
281282
return nil, err
282283
}
@@ -292,7 +293,7 @@ func Test_Encoding_Bind(t *testing.T) {
292293
{
293294
"form - MultipartForm",
294295
func() (*http.Request, error) {
295-
r, err := http.NewRequest(http.MethodPost, "http://example.com", nil)
296+
r, err := http.NewRequestWithContext(context.Background(), http.MethodPost, "http://example.com", nil)
296297
if err != nil {
297298
return nil, err
298299
}
@@ -315,7 +316,7 @@ func Test_Encoding_Bind(t *testing.T) {
315316
{
316317
"json",
317318
func() (*http.Request, error) {
318-
r, err := http.NewRequest(http.MethodPost, "http://example.com", bytes.NewReader([]byte(`{"id":"foo"}`)))
319+
r, err := http.NewRequestWithContext(context.Background(), http.MethodPost, "http://example.com", bytes.NewReader([]byte(`{"id":"foo"}`)))
319320
if err != nil {
320321
return nil, err
321322
}
@@ -350,7 +351,7 @@ func Test_Encoding_Bind(t *testing.T) {
350351
{
351352
"yaml",
352353
func() (*http.Request, error) {
353-
r, err := http.NewRequest(http.MethodPost, "http://example.com", bytes.NewReader([]byte("id: foo\nname: bar")))
354+
r, err := http.NewRequestWithContext(context.Background(), http.MethodPost, "http://example.com", bytes.NewReader([]byte("id: foo\nname: bar")))
354355
if err != nil {
355356
return nil, err
356357
}
@@ -366,7 +367,7 @@ func Test_Encoding_Bind(t *testing.T) {
366367
{
367368
"xml",
368369
func() (*http.Request, error) {
369-
r, err := http.NewRequest(http.MethodPost, "http://example.com", bytes.NewReader([]byte("<TestMode><id>foo</id><name>bar</name></TestMode>")))
370+
r, err := http.NewRequestWithContext(context.Background(), http.MethodPost, "http://example.com", bytes.NewReader([]byte("<TestMode><id>foo</id><name>bar</name></TestMode>")))
370371
if err != nil {
371372
return nil, err
372373
}
@@ -457,7 +458,7 @@ func Test_Encoding_BindQuery(t *testing.T) {
457458
{
458459
"form - no proto",
459460
func() (*http.Request, error) {
460-
r, err := http.NewRequest(http.MethodGet, "http://example.com?id=foo&name=bar", nil)
461+
r, err := http.NewRequestWithContext(context.Background(), http.MethodGet, "http://example.com?id=foo&name=bar", nil)
461462
if err != nil {
462463
return nil, err
463464
}
@@ -472,7 +473,7 @@ func Test_Encoding_BindQuery(t *testing.T) {
472473
{
473474
"form - proto",
474475
func() (*http.Request, error) {
475-
r, err := http.NewRequest(http.MethodGet, "http://example.com?id=11&uint32=1234&bool=true", nil)
476+
r, err := http.NewRequestWithContext(context.Background(), http.MethodGet, "http://example.com?id=11&uint32=1234&bool=true", nil)
476477
if err != nil {
477478
return nil, err
478479
}

0 commit comments

Comments
 (0)