MCPcopy
hub / github.com/IBM/sarama / ResetState

Method ResetState

internal/toxiproxy/client.go:78–95  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

76}
77
78func (c *Client) ResetState() error {
79 req, err := http.NewRequest("POST", c.endpoint+"/reset", http.NoBody)
80 if err != nil {
81 return fmt.Errorf("failed to make reset request: %w", err)
82 }
83 resp, err := c.httpClient.Do(req) // #nosec G704 -- toxiproxy endpoint is controlled test infrastructure.
84 if err != nil {
85 return fmt.Errorf("failed to http post reset: %w", err)
86 }
87 defer resp.Body.Close()
88
89 if resp.StatusCode != 204 {
90 body, _ := io.ReadAll(resp.Body)
91 return fmt.Errorf("error resetting proxies: %s %s", resp.Status, body)
92 }
93
94 return nil
95}

Callers 1

resetProxiesFunction · 0.80

Implementers 2

stubLeaderClientasync_producer_test.go
clientclient.go

Calls 2

ErrorfMethod · 0.65
CloseMethod · 0.65

Tested by 1

resetProxiesFunction · 0.64