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