MCPcopy Create free account
hub / github.com/rabbitstack/fibratus / initHTTP

Function initHTTP

pkg/outputs/http/http.go:52–77  ·  view source on GitHub ↗
(config outputs.Config)

Source from the content-addressed store, hash-verified

50}
51
52func initHTTP(config outputs.Config) (outputs.OutputGroup, error) {
53 cfg, ok := config.Output.(Config)
54 if !ok {
55 return outputs.Fail(outputs.ErrInvalidConfig(outputs.HTTP, config.Output))
56 }
57
58 clients := make([]outputs.Client, len(cfg.Endpoints))
59 for i, endpoint := range cfg.Endpoints {
60 _, err := url.Parse(endpoint)
61 if err != nil {
62 return outputs.Fail(err)
63 }
64 client, err := newHTTPClient(cfg)
65 if err != nil {
66 return outputs.Fail(err)
67 }
68
69 clients[i] = &_http{
70 client: client,
71 config: cfg,
72 url: endpoint,
73 }
74 }
75
76 return outputs.Success(clients...), nil
77}
78
79func (h *_http) Connect() error { return nil }
80func (h *_http) Close() error { return nil }

Callers

nothing calls this directly

Calls 3

FailFunction · 0.92
SuccessFunction · 0.92
newHTTPClientFunction · 0.85

Tested by

no test coverage detected