MCPcopy Create free account
hub / github.com/coder/coder / makeRequest

Method makeRequest

aibridge/internal/integrationtest/setupbridge.go:66–82  ·  view source on GitHub ↗

makeRequest builds and executes an HTTP request against this server. Optional headers are applied after the default Content-Type.

(t *testing.T, method string, path string, body []byte, header ...http.Header)

Source from the content-addressed store, hash-verified

64// makeRequest builds and executes an HTTP request against this server.
65// Optional headers are applied after the default Content-Type.
66func (s *bridgeTestServer) makeRequest(t *testing.T, method string, path string, body []byte, header ...http.Header) (*http.Response, error) {
67 t.Helper()
68
69 req, err := http.NewRequestWithContext(t.Context(), method, s.URL+path, bytes.NewReader(body))
70 if err != nil {
71 return nil, err
72 }
73 req.Header.Set("Content-Type", "application/json")
74 for _, h := range header {
75 for k, vals := range h {
76 for _, v := range vals {
77 req.Header.Add(k, v)
78 }
79 }
80 }
81 return http.DefaultClient.Do(req)
82}
83
84type bridgeOption func(*bridgeConfig)
85

Calls 5

HelperMethod · 0.65
ContextMethod · 0.65
SetMethod · 0.65
AddMethod · 0.65
DoMethod · 0.65