MCPcopy
hub / github.com/keploy/keploy / buildHTTPDoc

Function buildHTTPDoc

pkg/platform/yaml/codec_test.go:23–49  ·  view source on GitHub ↗

buildHTTPDoc creates a NetworkTrafficDoc with an HTTP spec for testing.

()

Source from the content-addressed store, hash-verified

21
22// buildHTTPDoc creates a NetworkTrafficDoc with an HTTP spec for testing.
23func buildHTTPDoc() *NetworkTrafficDoc {
24 doc := &NetworkTrafficDoc{
25 Version: models.V1Beta1,
26 Kind: models.HTTP,
27 Name: "test-1",
28 Curl: "curl http://localhost:8080/api",
29 }
30 spec := models.HTTPSchema{
31 Request: models.HTTPReq{
32 Method: "GET",
33 URL: "http://localhost:8080/api",
34 Header: map[string]string{"Content-Type": "application/json"},
35 Body: `{"key":"value"}`,
36 },
37 Response: models.HTTPResp{
38 StatusCode: 200,
39 StatusMessage: "OK",
40 Header: map[string]string{"Content-Type": "application/json"},
41 Body: `{"result":"ok"}`,
42 },
43 Created: 1700000000,
44 }
45 if err := doc.Spec.Encode(spec); err != nil {
46 panic(err)
47 }
48 return doc
49}
50
51func TestParseFormat(t *testing.T) {
52 tests := []struct {

Calls

no outgoing calls

Tested by

no test coverage detected