Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
jkralik committed Jul 4, 2024
1 parent 0c28c2a commit c863239
Showing 1 changed file with 0 additions and 64 deletions.
64 changes: 0 additions & 64 deletions m2m-oauth-server/test/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,70 +138,6 @@ func GetSecret(t require.TestingT, clientID string) string {
return ""
}

/*
func NewRequestBuilder(method, host, url string, body io.Reader) *RequestBuilder {
b := RequestBuilder{
method: method,
body: body,
uri: fmt.Sprintf("https://%s%s", host, url),
uriParams: make(map[string]interface{}),
header: make(map[string]string),
queryParams: make(map[string]string),
}
return &b
}
type RequestBuilder struct {
method string
body io.Reader
uri string
uriParams map[string]interface{}
header map[string]string
queryParams map[string]string
}
func (c *RequestBuilder) AddQuery(key, value string) *RequestBuilder {
c.queryParams[key] = value
return c
}
func (c *RequestBuilder) Build() *http.Request {
tmp, _ := uritemplates.Parse(c.uri)
uri, _ := tmp.Expand(c.uriParams)
url, _ := url.Parse(uri)
query := url.Query()
for k, v := range c.queryParams {
query.Set(k, v)
}
url.RawQuery = query.Encode()
request, _ := http.NewRequest(c.method, url.String(), c.body)
for k, v := range c.header {
request.Header.Add(k, v)
}
return request
}
func HTTPDo(t require.TestingT, req *http.Request, followRedirect bool) *http.Response {
trans := http.DefaultTransport.(*http.Transport).Clone()
trans.TLSClientConfig = &tls.Config{
InsecureSkipVerify: true,
}
c := &http.Client{
Transport: trans,
}
if !followRedirect {
c.CheckRedirect = func(*http.Request, []*http.Request) error {
return http.ErrUseLastResponse
}
}
resp, err := c.Do(req)
require.NoError(t, err)
return resp
}
*/

type AccessTokenOptions struct {
Host string
ClientID string
Expand Down

0 comments on commit c863239

Please sign in to comment.