From 16b51016002f6dc2370e99ee3fcc4309622bf096 Mon Sep 17 00:00:00 2001 From: dudaodong Date: Tue, 28 Dec 2021 10:56:54 +0800 Subject: [PATCH] fix: fix TestHttpPost timeout issue --- netutil/request_test.go | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/netutil/request_test.go b/netutil/request_test.go index f0e73a4..60b4780 100644 --- a/netutil/request_test.go +++ b/netutil/request_test.go @@ -32,16 +32,12 @@ func TestHttpGet(t *testing.T) { } func TestHttpPost(t *testing.T) { - url := "http://public-api-v1.aspirantzhang.com/users" - type User struct { - Name string `json:"name"` - Email string `json:"email"` + url := "http://api.postcodes.io/postcodes" + type Postcode struct { + Postcodes []string `json:"postcodes"` } - user := User{ - "test", - "test@test.com", - } - bodyParams, _ := json.Marshal(user) + postcode := Postcode{[]string{"OX49 5NU"}} + bodyParams, _ := json.Marshal(postcode) header := map[string]string{ "Content-Type": "application/json", }