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

Write the implementation of request().

go · basicsInDrive - 3Q3 2025не решено

Write the implementation of request().

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
}

Источник: InDrive - 3 · Q3 2025

← Design a database for a company that ha… · Все задачи · Go · Что выведет на экран →