Перейти к содержимому

InDrive - 3

Актуальность: Q3 2025

func doRequest(addr string, request []byte) ([]byte, error) {
resp, err := http.Post(addr, "text/plain ", bytes.NewBuffer(request))
if err != nil {
return nil, err
}
defer resp.Body.Close()
body, err := io.ReadAll(resp.Body)
if err != nil {
return nil, err
}
return body, nil
}
type client struct {
addrs []string
}
func (dc client) request(ctx context.Context, req string) (string, error) {
// implementation
}