diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8aed1ed9900..00569c3040a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,9 +15,11 @@ jobs: steps: - uses: actions/checkout@v4 - + - name: Setup go uses: actions/setup-go@v5 - run: | go build ./... + + diff --git a/option/requestoption.go b/option/requestoption.go index 16e0bd8660f..3dada6b2fbb 100644 --- a/option/requestoption.go +++ b/option/requestoption.go @@ -191,7 +191,10 @@ func WithResponseInto(dst **http.Response) RequestOption { } } -// WithRequestBody returns a RequestOption that provides a custom serialized body with content type. +// WithRequestBody returns a RequestOption that provides a custom serialized body with the given +// content type. +// +// body accepts an io.Reader or raw []bytes. func WithRequestBody(contentType string, body any) RequestOption { return func(r *requestconfig.RequestConfig) error { if reader, ok := body.(io.Reader); ok { @@ -204,7 +207,7 @@ func WithRequestBody(contentType string, body any) RequestOption { return r.Apply(WithHeader("Content-Type", contentType)) } - return fmt.Errorf("body is must either be a byte slice or implement io.Reader") + return fmt.Errorf("body must be a byte slice or implement io.Reader") } }