MCPcopy
hub / github.com/argoproj/argo-workflows / EventStreamReader

Method EventStreamReader

pkg/apiclient/http1/facade.go:52–91  ·  view source on GitHub ↗
(ctx context.Context, in interface{}, path string)

Source from the content-addressed store, hash-verified

50}
51
52func (h Facade) EventStreamReader(ctx context.Context, in interface{}, path string) (*bufio.Reader, error) {
53 log := logging.RequireLoggerFromContext(ctx)
54 method := "GET"
55 u, err := h.url(method, path, in)
56 if err != nil {
57 return nil, err
58 }
59 req, err := http.NewRequestWithContext(ctx, http.MethodGet, u.String(), nil)
60 if err != nil {
61 return nil, err
62 }
63 headers, err := parseHeaders(h.headers)
64 if err != nil {
65 return nil, err
66 }
67 req.Header = headers
68 req.Header.Set("Accept", "text/event-stream")
69 req.Header.Set("Authorization", h.authorization)
70 log.WithField("url", u).Debug(ctx, "curl -H 'Accept: text/event-stream' -H 'Authorization: ******'")
71 client := h.httpClient
72 if h.httpClient == nil {
73 client = &http.Client{
74 Transport: &http.Transport{
75 TLSClientConfig: &tls.Config{
76 InsecureSkipVerify: h.insecureSkipVerify,
77 },
78 },
79 }
80 }
81 resp, err := client.Do(req)
82 if err != nil {
83 return nil, err
84 }
85 err = errFromResponse(resp)
86 if err != nil {
87 resp.Body.Close()
88 return nil, err
89 }
90 return bufio.NewReader(resp.Body), nil
91}
92
93func (h Facade) do(ctx context.Context, in interface{}, out interface{}, method string, path string) error {
94 log := logging.RequireLoggerFromContext(ctx)

Callers 4

WatchWorkflowsMethod · 0.80
WatchEventsMethod · 0.80
PodLogsMethod · 0.80
WorkflowLogsMethod · 0.80

Calls 10

urlMethod · 0.95
RequireLoggerFromContextFunction · 0.92
parseHeadersFunction · 0.85
errFromResponseFunction · 0.85
DebugMethod · 0.65
WithFieldMethod · 0.65
DoMethod · 0.65
CloseMethod · 0.65
StringMethod · 0.45
SetMethod · 0.45

Tested by

no test coverage detected