forked from snowflakedb/gosnowflake
-
Notifications
You must be signed in to change notification settings - Fork 0
/
client.go
38 lines (32 loc) · 990 Bytes
/
client.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// Copyright (c) 2021-2022 Snowflake Computing Inc. All rights reserved.
package gosnowflake
import (
"context"
"net/http"
"net/url"
"time"
)
// InternalClient is implemented by HTTPClient
type InternalClient interface {
Get(context.Context, *url.URL, map[string]string, time.Duration) (*http.Response, error)
Post(context.Context, *url.URL, map[string]string, []byte, time.Duration, currentTimeProvider) (*http.Response, error)
}
type httpClient struct {
sr *snowflakeRestful
}
func (cli *httpClient) Get(
ctx context.Context,
url *url.URL,
headers map[string]string,
timeout time.Duration) (*http.Response, error) {
return cli.sr.FuncGet(ctx, cli.sr, url, headers, timeout)
}
func (cli *httpClient) Post(
ctx context.Context,
url *url.URL,
headers map[string]string,
body []byte,
timeout time.Duration,
currentTimeProvider currentTimeProvider) (*http.Response, error) {
return cli.sr.FuncPost(ctx, cli.sr, url, headers, body, timeout, currentTimeProvider, nil)
}