From 956be3a2fe2444d24aaa7424147042fb0c3d209e Mon Sep 17 00:00:00 2001 From: my-git9 Date: Wed, 22 Feb 2023 10:56:25 +0800 Subject: [PATCH] [receiver/opencensusreceiver]Use http constants to replace numbers (#18830) Signed-off-by: xin.li --- receiver/opencensusreceiver/opencensus_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/receiver/opencensusreceiver/opencensus_test.go b/receiver/opencensusreceiver/opencensus_test.go index 03f375e11b84..4ea3293a4e7f 100644 --- a/receiver/opencensusreceiver/opencensus_test.go +++ b/receiver/opencensusreceiver/opencensus_test.go @@ -100,7 +100,7 @@ func TestGrpcGateway_endToEnd(t *testing.T) { } ] }`) - req, err := http.NewRequest("POST", url, bytes.NewBuffer(traceJSON)) + req, err := http.NewRequest(http.MethodPost, url, bytes.NewBuffer(traceJSON)) require.NoError(t, err, "Error creating trace POST request: %v", err) req.Header.Set("Content-Type", "application/json") @@ -197,7 +197,7 @@ func TestMetricsGrpcGatewayCors_endToEnd(t *testing.T) { } func verifyCorsResp(t *testing.T, url string, origin string, wantStatus int, wantAllowed bool) { - req, err := http.NewRequest("OPTIONS", url, nil) + req, err := http.NewRequest(http.MethodOptions, url, nil) require.NoError(t, err, "Error creating trace OPTIONS request: %v", err) req.Header.Set("Origin", origin) req.Header.Set("Access-Control-Request-Method", "POST")