Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit244d1a2

Browse files
committed
codersdk: Create requestOption type
1 parent74d14b1 commit244d1a2

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

‎codersdk/client.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,11 @@ type Client struct {
3333
URL*url.URL
3434
}
3535

36+
typerequestOptionfunc(*http.Request)
37+
3638
// request performs an HTTP request with the body provided.
3739
// The caller is responsible for closing the response body.
38-
func (c*Client)request(ctx context.Context,method,pathstring,bodyinterface{},opts...func(r*http.Request)) (*http.Response,error) {
40+
func (c*Client)request(ctx context.Context,method,pathstring,bodyinterface{},opts...requestOption) (*http.Response,error) {
3941
serverURL,err:=c.URL.Parse(path)
4042
iferr!=nil {
4143
returnnil,xerrors.Errorf("parse url: %w",err)

‎codersdk/pagination.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ type Pagination struct {
2828

2929
// asRequestOption returns a function that can be used in (*Client).request.
3030
// It modifies the request query parameters.
31-
func (pPagination)asRequestOption()func(*http.Request) {
31+
func (pPagination)asRequestOption()requestOption {
3232
returnfunc(r*http.Request) {
3333
q:=r.URL.Query()
3434
ifp.AfterID!=uuid.Nil {

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp