Skip to content

Commit 8508138

Browse files
committed
comments
1 parent a4f205e commit 8508138

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

enterprise/wsproxy/wsproxysdk/client.go

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,57 +14,57 @@ import (
1414
// Client is a HTTP client for a subset of Coder API routes that external
1515
// proxies need.
1616
type Client struct {
17-
CoderSDKClient *codersdk.Client
17+
SDKClient *codersdk.Client
1818
// HACK: the issue-signed-app-token requests may issue redirect responses
1919
// (which need to be forwarded to the client), so the client we use to make
2020
// those requests must ignore redirects.
21-
CoderSDKClientIgnoreRedirects *codersdk.Client
21+
sdkClientIgnoreRedirects *codersdk.Client
2222
}
2323

2424
// New creates a external proxy client for the provided primary coder server
2525
// URL.
2626
func New(serverURL *url.URL) *Client {
27-
coderSDKClient := codersdk.New(serverURL)
28-
coderSDKClient.SessionTokenHeader = httpmw.WorkspaceProxyAuthTokenHeader
27+
sdkClient := codersdk.New(serverURL)
28+
sdkClient.SessionTokenHeader = httpmw.WorkspaceProxyAuthTokenHeader
2929

30-
coderSDKClientIgnoreRedirects := codersdk.New(serverURL)
31-
coderSDKClientIgnoreRedirects.HTTPClient.CheckRedirect = func(req *http.Request, via []*http.Request) error {
30+
sdkClientIgnoreRedirects := codersdk.New(serverURL)
31+
sdkClientIgnoreRedirects.HTTPClient.CheckRedirect = func(req *http.Request, via []*http.Request) error {
3232
return http.ErrUseLastResponse
3333
}
34-
coderSDKClientIgnoreRedirects.SessionTokenHeader = httpmw.WorkspaceProxyAuthTokenHeader
34+
sdkClientIgnoreRedirects.SessionTokenHeader = httpmw.WorkspaceProxyAuthTokenHeader
3535

3636
return &Client{
37-
CoderSDKClient: coderSDKClient,
38-
CoderSDKClientIgnoreRedirects: coderSDKClientIgnoreRedirects,
37+
SDKClient: sdkClient,
38+
sdkClientIgnoreRedirects: sdkClientIgnoreRedirects,
3939
}
4040
}
4141

4242
// SetSessionToken sets the session token for the client. An error is returned
4343
// if the session token is not in the correct format for external proxies.
4444
func (c *Client) SetSessionToken(token string) error {
45-
c.CoderSDKClient.SetSessionToken(token)
46-
c.CoderSDKClientIgnoreRedirects.SetSessionToken(token)
45+
c.SDKClient.SetSessionToken(token)
46+
c.sdkClientIgnoreRedirects.SetSessionToken(token)
4747
return nil
4848
}
4949

5050
// SessionToken returns the currently set token for the client.
5151
func (c *Client) SessionToken() string {
52-
return c.CoderSDKClient.SessionToken()
52+
return c.SDKClient.SessionToken()
5353
}
5454

5555
// Request wraps the underlying codersdk.Client's Request method.
5656
func (c *Client) Request(ctx context.Context, method, path string, body interface{}, opts ...codersdk.RequestOption) (*http.Response, error) {
57-
return c.CoderSDKClient.Request(ctx, method, path, body, opts...)
57+
return c.SDKClient.Request(ctx, method, path, body, opts...)
5858
}
5959

6060
// RequestIgnoreRedirects wraps the underlying codersdk.Client's Request method
6161
// on the client that ignores redirects.
6262
func (c *Client) RequestIgnoreRedirects(ctx context.Context, method, path string, body interface{}, opts ...codersdk.RequestOption) (*http.Response, error) {
63-
return c.CoderSDKClientIgnoreRedirects.Request(ctx, method, path, body, opts...)
63+
return c.sdkClientIgnoreRedirects.Request(ctx, method, path, body, opts...)
6464
}
6565

6666
// DialWorkspaceAgent calls the underlying codersdk.Client's DialWorkspaceAgent
6767
// method.
6868
func (c *Client) DialWorkspaceAgent(ctx context.Context, agentID uuid.UUID, options *codersdk.DialWorkspaceAgentOptions) (agentConn *codersdk.WorkspaceAgentConn, err error) {
69-
return c.CoderSDKClient.DialWorkspaceAgent(ctx, agentID, options)
69+
return c.SDKClient.DialWorkspaceAgent(ctx, agentID, options)
7070
}

0 commit comments

Comments
 (0)