From 8c9fff3341f8dbd41c93ded6dbc5718e29a1c6f8 Mon Sep 17 00:00:00 2001 From: stainless-bot Date: Fri, 12 Apr 2024 17:22:13 +0000 Subject: [PATCH] feat(api): update via SDK Studio --- .github/workflows/ci.yml | 4 +++- option/requestoption.go | 7 +++++-- 2 files changed, 8 insertions(+), 3 deletions(-) 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") } }