mcp: add a test for streamable accept headers
Add a test following up on the fix for #290.
This commit is contained in:
parent
cfa5c1d802
commit
54c99810f6
1 changed files with 143 additions and 102 deletions
|
|
@ -345,30 +345,6 @@ func TestStreamableServerTransport(t *testing.T) {
|
||||||
// faking the behavior of a streamable client using a sequence of HTTP
|
// faking the behavior of a streamable client using a sequence of HTTP
|
||||||
// requests.
|
// requests.
|
||||||
|
|
||||||
// A step is a single step in the tests below, consisting of a request payload
|
|
||||||
// and expected response.
|
|
||||||
type step struct {
|
|
||||||
// If OnRequest is > 0, this step only executes after a request with the
|
|
||||||
// given ID is received.
|
|
||||||
//
|
|
||||||
// All OnRequest steps must occur before the step that creates the request.
|
|
||||||
//
|
|
||||||
// To avoid tests hanging when there's a bug, it's expected that this
|
|
||||||
// request is received in the course of a *synchronous* request to the
|
|
||||||
// server (otherwise, we wouldn't be able to terminate the test without
|
|
||||||
// analyzing a dependency graph).
|
|
||||||
OnRequest int64
|
|
||||||
// If set, Async causes the step to run asynchronously to other steps.
|
|
||||||
// Redundant with OnRequest: all OnRequest steps are asynchronous.
|
|
||||||
Async bool
|
|
||||||
|
|
||||||
Method string // HTTP request method
|
|
||||||
Send []jsonrpc.Message // messages to send
|
|
||||||
CloseAfter int // if nonzero, close after receiving this many messages
|
|
||||||
StatusCode int // expected status code
|
|
||||||
Recv []jsonrpc.Message // expected messages to receive
|
|
||||||
}
|
|
||||||
|
|
||||||
// JSON-RPC message constructors.
|
// JSON-RPC message constructors.
|
||||||
req := func(id int64, method string, params any) *jsonrpc.Request {
|
req := func(id int64, method string, params any) *jsonrpc.Request {
|
||||||
r := &jsonrpc.Request{
|
r := &jsonrpc.Request{
|
||||||
|
|
@ -399,33 +375,67 @@ func TestStreamableServerTransport(t *testing.T) {
|
||||||
ServerInfo: &Implementation{Name: "testServer", Version: "v1.0.0"},
|
ServerInfo: &Implementation{Name: "testServer", Version: "v1.0.0"},
|
||||||
}, nil)
|
}, nil)
|
||||||
initializedMsg := req(0, notificationInitialized, &InitializedParams{})
|
initializedMsg := req(0, notificationInitialized, &InitializedParams{})
|
||||||
initialize := step{
|
initialize := streamableRequest{
|
||||||
Method: "POST",
|
method: "POST",
|
||||||
Send: []jsonrpc.Message{initReq},
|
messages: []jsonrpc.Message{initReq},
|
||||||
StatusCode: http.StatusOK,
|
wantStatusCode: http.StatusOK,
|
||||||
Recv: []jsonrpc.Message{initResp},
|
wantMessages: []jsonrpc.Message{initResp},
|
||||||
}
|
}
|
||||||
initialized := step{
|
initialized := streamableRequest{
|
||||||
Method: "POST",
|
method: "POST",
|
||||||
Send: []jsonrpc.Message{initializedMsg},
|
messages: []jsonrpc.Message{initializedMsg},
|
||||||
StatusCode: http.StatusAccepted,
|
wantStatusCode: http.StatusAccepted,
|
||||||
}
|
}
|
||||||
|
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
name string
|
name string
|
||||||
tool func(*testing.T, context.Context, *ServerSession)
|
tool func(*testing.T, context.Context, *ServerSession)
|
||||||
steps []step
|
steps []streamableRequest
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
name: "basic",
|
name: "basic",
|
||||||
steps: []step{
|
steps: []streamableRequest{
|
||||||
initialize,
|
initialize,
|
||||||
initialized,
|
initialized,
|
||||||
{
|
{
|
||||||
Method: "POST",
|
method: "POST",
|
||||||
Send: []jsonrpc.Message{req(2, "tools/call", &CallToolParams{Name: "tool"})},
|
messages: []jsonrpc.Message{req(2, "tools/call", &CallToolParams{Name: "tool"})},
|
||||||
StatusCode: http.StatusOK,
|
wantStatusCode: http.StatusOK,
|
||||||
Recv: []jsonrpc.Message{resp(2, &CallToolResult{}, nil)},
|
wantMessages: []jsonrpc.Message{resp(2, &CallToolResult{}, nil)},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "accept headers",
|
||||||
|
steps: []streamableRequest{
|
||||||
|
initialize,
|
||||||
|
initialized,
|
||||||
|
// Test various accept headers.
|
||||||
|
{
|
||||||
|
method: "POST",
|
||||||
|
accept: []string{"text/plain", "application/*"},
|
||||||
|
messages: []jsonrpc.Message{req(3, "tools/call", &CallToolParams{Name: "tool"})},
|
||||||
|
wantStatusCode: http.StatusBadRequest, // missing text/event-stream
|
||||||
|
},
|
||||||
|
{
|
||||||
|
method: "POST",
|
||||||
|
accept: []string{"text/event-stream"},
|
||||||
|
messages: []jsonrpc.Message{req(3, "tools/call", &CallToolParams{Name: "tool"})},
|
||||||
|
wantStatusCode: http.StatusBadRequest, // missing application/json
|
||||||
|
},
|
||||||
|
{
|
||||||
|
method: "POST",
|
||||||
|
accept: []string{"text/plain", "*/*"},
|
||||||
|
messages: []jsonrpc.Message{req(4, "tools/call", &CallToolParams{Name: "tool"})},
|
||||||
|
wantStatusCode: http.StatusOK,
|
||||||
|
wantMessages: []jsonrpc.Message{resp(4, &CallToolResult{}, nil)},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
method: "POST",
|
||||||
|
accept: []string{"text/*, application/*"},
|
||||||
|
messages: []jsonrpc.Message{req(4, "tools/call", &CallToolParams{Name: "tool"})},
|
||||||
|
wantStatusCode: http.StatusOK,
|
||||||
|
wantMessages: []jsonrpc.Message{resp(4, &CallToolResult{}, nil)},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
@ -437,16 +447,16 @@ func TestStreamableServerTransport(t *testing.T) {
|
||||||
t.Errorf("Notify failed: %v", err)
|
t.Errorf("Notify failed: %v", err)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
steps: []step{
|
steps: []streamableRequest{
|
||||||
initialize,
|
initialize,
|
||||||
initialized,
|
initialized,
|
||||||
{
|
{
|
||||||
Method: "POST",
|
method: "POST",
|
||||||
Send: []jsonrpc.Message{
|
messages: []jsonrpc.Message{
|
||||||
req(2, "tools/call", &CallToolParams{Name: "tool"}),
|
req(2, "tools/call", &CallToolParams{Name: "tool"}),
|
||||||
},
|
},
|
||||||
StatusCode: http.StatusOK,
|
wantStatusCode: http.StatusOK,
|
||||||
Recv: []jsonrpc.Message{
|
wantMessages: []jsonrpc.Message{
|
||||||
req(0, "notifications/progress", &ProgressNotificationParams{}),
|
req(0, "notifications/progress", &ProgressNotificationParams{}),
|
||||||
resp(2, &CallToolResult{}, nil),
|
resp(2, &CallToolResult{}, nil),
|
||||||
},
|
},
|
||||||
|
|
@ -461,24 +471,24 @@ func TestStreamableServerTransport(t *testing.T) {
|
||||||
t.Errorf("Call failed: %v", err)
|
t.Errorf("Call failed: %v", err)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
steps: []step{
|
steps: []streamableRequest{
|
||||||
initialize,
|
initialize,
|
||||||
initialized,
|
initialized,
|
||||||
{
|
{
|
||||||
Method: "POST",
|
method: "POST",
|
||||||
OnRequest: 1,
|
onRequest: 1,
|
||||||
Send: []jsonrpc.Message{
|
messages: []jsonrpc.Message{
|
||||||
resp(1, &ListRootsResult{}, nil),
|
resp(1, &ListRootsResult{}, nil),
|
||||||
},
|
},
|
||||||
StatusCode: http.StatusAccepted,
|
wantStatusCode: http.StatusAccepted,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Method: "POST",
|
method: "POST",
|
||||||
Send: []jsonrpc.Message{
|
messages: []jsonrpc.Message{
|
||||||
req(2, "tools/call", &CallToolParams{Name: "tool"}),
|
req(2, "tools/call", &CallToolParams{Name: "tool"}),
|
||||||
},
|
},
|
||||||
StatusCode: http.StatusOK,
|
wantStatusCode: http.StatusOK,
|
||||||
Recv: []jsonrpc.Message{
|
wantMessages: []jsonrpc.Message{
|
||||||
req(1, "roots/list", &ListRootsParams{}),
|
req(1, "roots/list", &ListRootsParams{}),
|
||||||
resp(2, &CallToolResult{}, nil),
|
resp(2, &CallToolResult{}, nil),
|
||||||
},
|
},
|
||||||
|
|
@ -502,34 +512,34 @@ func TestStreamableServerTransport(t *testing.T) {
|
||||||
t.Errorf("Notify failed: %v", err)
|
t.Errorf("Notify failed: %v", err)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
steps: []step{
|
steps: []streamableRequest{
|
||||||
initialize,
|
initialize,
|
||||||
initialized,
|
initialized,
|
||||||
{
|
{
|
||||||
Method: "POST",
|
method: "POST",
|
||||||
OnRequest: 1,
|
onRequest: 1,
|
||||||
Send: []jsonrpc.Message{
|
messages: []jsonrpc.Message{
|
||||||
resp(1, &ListRootsResult{}, nil),
|
resp(1, &ListRootsResult{}, nil),
|
||||||
},
|
},
|
||||||
StatusCode: http.StatusAccepted,
|
wantStatusCode: http.StatusAccepted,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Method: "GET",
|
method: "GET",
|
||||||
Async: true,
|
async: true,
|
||||||
StatusCode: http.StatusOK,
|
wantStatusCode: http.StatusOK,
|
||||||
CloseAfter: 2,
|
closeAfter: 2,
|
||||||
Recv: []jsonrpc.Message{
|
wantMessages: []jsonrpc.Message{
|
||||||
req(0, "notifications/progress", &ProgressNotificationParams{}),
|
req(0, "notifications/progress", &ProgressNotificationParams{}),
|
||||||
req(1, "roots/list", &ListRootsParams{}),
|
req(1, "roots/list", &ListRootsParams{}),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Method: "POST",
|
method: "POST",
|
||||||
Send: []jsonrpc.Message{
|
messages: []jsonrpc.Message{
|
||||||
req(2, "tools/call", &CallToolParams{Name: "tool"}),
|
req(2, "tools/call", &CallToolParams{Name: "tool"}),
|
||||||
},
|
},
|
||||||
StatusCode: http.StatusOK,
|
wantStatusCode: http.StatusOK,
|
||||||
Recv: []jsonrpc.Message{
|
wantMessages: []jsonrpc.Message{
|
||||||
resp(2, &CallToolResult{}, nil),
|
resp(2, &CallToolResult{}, nil),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
@ -537,30 +547,30 @@ func TestStreamableServerTransport(t *testing.T) {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "errors",
|
name: "errors",
|
||||||
steps: []step{
|
steps: []streamableRequest{
|
||||||
{
|
{
|
||||||
Method: "PUT",
|
method: "PUT",
|
||||||
StatusCode: http.StatusMethodNotAllowed,
|
wantStatusCode: http.StatusMethodNotAllowed,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Method: "DELETE",
|
method: "DELETE",
|
||||||
StatusCode: http.StatusBadRequest,
|
wantStatusCode: http.StatusBadRequest,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Method: "POST",
|
method: "POST",
|
||||||
Send: []jsonrpc.Message{req(1, "notamethod", nil)},
|
messages: []jsonrpc.Message{req(1, "notamethod", nil)},
|
||||||
StatusCode: http.StatusBadRequest, // notamethod is an invalid method
|
wantStatusCode: http.StatusBadRequest, // notamethod is an invalid method
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Method: "POST",
|
method: "POST",
|
||||||
Send: []jsonrpc.Message{req(0, "tools/call", &CallToolParams{Name: "tool"})},
|
messages: []jsonrpc.Message{req(0, "tools/call", &CallToolParams{Name: "tool"})},
|
||||||
StatusCode: http.StatusBadRequest, // tools/call must have an ID
|
wantStatusCode: http.StatusBadRequest, // tools/call must have an ID
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Method: "POST",
|
method: "POST",
|
||||||
Send: []jsonrpc.Message{req(2, "tools/call", &CallToolParams{Name: "tool"})},
|
messages: []jsonrpc.Message{req(2, "tools/call", &CallToolParams{Name: "tool"})},
|
||||||
StatusCode: http.StatusOK,
|
wantStatusCode: http.StatusOK,
|
||||||
Recv: []jsonrpc.Message{resp(2, nil, &jsonrpc2.WireError{
|
wantMessages: []jsonrpc.Message{resp(2, nil, &jsonrpc2.WireError{
|
||||||
Message: `method "tools/call" is invalid during session initialization`,
|
Message: `method "tools/call" is invalid during session initialization`,
|
||||||
})},
|
})},
|
||||||
},
|
},
|
||||||
|
|
@ -594,8 +604,8 @@ func TestStreamableServerTransport(t *testing.T) {
|
||||||
var mu sync.Mutex
|
var mu sync.Mutex
|
||||||
blocks := make(map[int64]chan struct{})
|
blocks := make(map[int64]chan struct{})
|
||||||
for _, step := range test.steps {
|
for _, step := range test.steps {
|
||||||
if step.OnRequest > 0 {
|
if step.onRequest > 0 {
|
||||||
blocks[step.OnRequest] = make(chan struct{})
|
blocks[step.onRequest] = make(chan struct{})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -609,16 +619,16 @@ func TestStreamableServerTransport(t *testing.T) {
|
||||||
sessionID.Store("")
|
sessionID.Store("")
|
||||||
|
|
||||||
// doStep executes a single step.
|
// doStep executes a single step.
|
||||||
doStep := func(t *testing.T, step step) {
|
doStep := func(t *testing.T, step streamableRequest) {
|
||||||
if step.OnRequest > 0 {
|
if step.onRequest > 0 {
|
||||||
// Block the step until we've received the server->client request.
|
// Block the step until we've received the server->client request.
|
||||||
mu.Lock()
|
mu.Lock()
|
||||||
block := blocks[step.OnRequest]
|
block := blocks[step.onRequest]
|
||||||
mu.Unlock()
|
mu.Unlock()
|
||||||
select {
|
select {
|
||||||
case <-block:
|
case <-block:
|
||||||
case <-syncRequestsDone:
|
case <-syncRequestsDone:
|
||||||
t.Errorf("after all sync requests are complete, request still blocked on %d", step.OnRequest)
|
t.Errorf("after all sync requests are complete, request still blocked on %d", step.onRequest)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -650,14 +660,13 @@ func TestStreamableServerTransport(t *testing.T) {
|
||||||
mu.Unlock()
|
mu.Unlock()
|
||||||
}
|
}
|
||||||
got = append(got, m)
|
got = append(got, m)
|
||||||
if step.CloseAfter > 0 && len(got) == step.CloseAfter {
|
if step.closeAfter > 0 && len(got) == step.closeAfter {
|
||||||
cancel()
|
cancel()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
gotSessionID, gotStatusCode, err := streamingRequest(ctx,
|
gotSessionID, gotStatusCode, err := step.do(ctx, httpServer.URL, sessionID.Load().(string), out)
|
||||||
httpServer.URL, sessionID.Load().(string), step.Method, step.Send, out)
|
|
||||||
|
|
||||||
// Don't fail on cancelled requests: error (if any) is handled
|
// Don't fail on cancelled requests: error (if any) is handled
|
||||||
// elsewhere.
|
// elsewhere.
|
||||||
|
|
@ -665,13 +674,13 @@ func TestStreamableServerTransport(t *testing.T) {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if gotStatusCode != step.StatusCode {
|
if gotStatusCode != step.wantStatusCode {
|
||||||
t.Errorf("got status %d, want %d", gotStatusCode, step.StatusCode)
|
t.Errorf("got status %d, want %d", gotStatusCode, step.wantStatusCode)
|
||||||
}
|
}
|
||||||
wg.Wait()
|
wg.Wait()
|
||||||
|
|
||||||
transform := cmpopts.AcyclicTransformer("jsonrpcid", func(id jsonrpc.ID) any { return id.Raw() })
|
transform := cmpopts.AcyclicTransformer("jsonrpcid", func(id jsonrpc.ID) any { return id.Raw() })
|
||||||
if diff := cmp.Diff(step.Recv, got, transform); diff != "" {
|
if diff := cmp.Diff(step.wantMessages, got, transform); diff != "" {
|
||||||
t.Errorf("received unexpected messages (-want +got):\n%s", diff)
|
t.Errorf("received unexpected messages (-want +got):\n%s", diff)
|
||||||
}
|
}
|
||||||
sessionID.CompareAndSwap("", gotSessionID)
|
sessionID.CompareAndSwap("", gotSessionID)
|
||||||
|
|
@ -679,7 +688,7 @@ func TestStreamableServerTransport(t *testing.T) {
|
||||||
|
|
||||||
var wg sync.WaitGroup
|
var wg sync.WaitGroup
|
||||||
for _, step := range test.steps {
|
for _, step := range test.steps {
|
||||||
if step.Async || step.OnRequest > 0 {
|
if step.async || step.onRequest > 0 {
|
||||||
wg.Add(1)
|
wg.Add(1)
|
||||||
go func() {
|
go func() {
|
||||||
defer wg.Done()
|
defer wg.Done()
|
||||||
|
|
@ -699,6 +708,33 @@ func TestStreamableServerTransport(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// A streamableRequest describes a single streamable HTTP request, consisting
|
||||||
|
// of a request payload and expected response.
|
||||||
|
type streamableRequest struct {
|
||||||
|
// If onRequest is > 0, this step only executes after a request with the
|
||||||
|
// given ID is received.
|
||||||
|
//
|
||||||
|
// All onRequest steps must occur before the step that creates the request.
|
||||||
|
//
|
||||||
|
// To avoid tests hanging when there's a bug, it's expected that this
|
||||||
|
// request is received in the course of a *synchronous* request to the
|
||||||
|
// server (otherwise, we wouldn't be able to terminate the test without
|
||||||
|
// analyzing a dependency graph).
|
||||||
|
onRequest int64
|
||||||
|
// If set, async causes the step to run asynchronously to other steps.
|
||||||
|
// Redundant with OnRequest: all OnRequest steps are asynchronous.
|
||||||
|
async bool
|
||||||
|
|
||||||
|
// Request attributes
|
||||||
|
method string // HTTP request method
|
||||||
|
accept []string // if non-empty, the Accept header to use; otherwise the default header is used
|
||||||
|
messages []jsonrpc.Message // messages to send
|
||||||
|
|
||||||
|
closeAfter int // if nonzero, close after receiving this many messages
|
||||||
|
wantStatusCode int // expected status code
|
||||||
|
wantMessages []jsonrpc.Message // expected messages to receive
|
||||||
|
}
|
||||||
|
|
||||||
// streamingRequest makes a request to the given streamable server with the
|
// streamingRequest makes a request to the given streamable server with the
|
||||||
// given url, sessionID, and method.
|
// given url, sessionID, and method.
|
||||||
//
|
//
|
||||||
|
|
@ -712,19 +748,19 @@ func TestStreamableServerTransport(t *testing.T) {
|
||||||
// Returns the sessionID and http status code from the response. If an error is
|
// Returns the sessionID and http status code from the response. If an error is
|
||||||
// returned, sessionID and status code may still be set if the error occurs
|
// returned, sessionID and status code may still be set if the error occurs
|
||||||
// after the response headers have been received.
|
// after the response headers have been received.
|
||||||
func streamingRequest(ctx context.Context, serverURL, sessionID, method string, in []jsonrpc.Message, out chan<- jsonrpc.Message) (string, int, error) {
|
func (s streamableRequest) do(ctx context.Context, serverURL, sessionID string, out chan<- jsonrpc.Message) (string, int, error) {
|
||||||
defer close(out)
|
defer close(out)
|
||||||
|
|
||||||
var body []byte
|
var body []byte
|
||||||
if len(in) == 1 {
|
if len(s.messages) == 1 {
|
||||||
data, err := jsonrpc2.EncodeMessage(in[0])
|
data, err := jsonrpc2.EncodeMessage(s.messages[0])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", 0, fmt.Errorf("encoding message: %w", err)
|
return "", 0, fmt.Errorf("encoding message: %w", err)
|
||||||
}
|
}
|
||||||
body = data
|
body = data
|
||||||
} else {
|
} else {
|
||||||
var rawMsgs []json.RawMessage
|
var rawMsgs []json.RawMessage
|
||||||
for _, msg := range in {
|
for _, msg := range s.messages {
|
||||||
data, err := jsonrpc2.EncodeMessage(msg)
|
data, err := jsonrpc2.EncodeMessage(msg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", 0, fmt.Errorf("encoding message: %w", err)
|
return "", 0, fmt.Errorf("encoding message: %w", err)
|
||||||
|
|
@ -738,7 +774,7 @@ func streamingRequest(ctx context.Context, serverURL, sessionID, method string,
|
||||||
body = data
|
body = data
|
||||||
}
|
}
|
||||||
|
|
||||||
req, err := http.NewRequestWithContext(ctx, method, serverURL, bytes.NewReader(body))
|
req, err := http.NewRequestWithContext(ctx, s.method, serverURL, bytes.NewReader(body))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", 0, fmt.Errorf("creating request: %w", err)
|
return "", 0, fmt.Errorf("creating request: %w", err)
|
||||||
}
|
}
|
||||||
|
|
@ -746,8 +782,13 @@ func streamingRequest(ctx context.Context, serverURL, sessionID, method string,
|
||||||
req.Header.Set("Mcp-Session-Id", sessionID)
|
req.Header.Set("Mcp-Session-Id", sessionID)
|
||||||
}
|
}
|
||||||
req.Header.Set("Content-Type", "application/json")
|
req.Header.Set("Content-Type", "application/json")
|
||||||
req.Header.Add("Accept", "text/plain") // ensure multiple accept headers are allowed
|
if len(s.accept) > 0 {
|
||||||
req.Header.Add("Accept", "application/json, text/event-stream")
|
for _, accept := range s.accept {
|
||||||
|
req.Header.Add("Accept", accept)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
req.Header.Add("Accept", "application/json, text/event-stream")
|
||||||
|
}
|
||||||
|
|
||||||
resp, err := http.DefaultClient.Do(req)
|
resp, err := http.DefaultClient.Do(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue