diff --git a/.github/workflows/handle-release-pr-title-edit.yml b/.github/workflows/handle-release-pr-title-edit.yml deleted file mode 100644 index 3b886e3..0000000 --- a/.github/workflows/handle-release-pr-title-edit.yml +++ /dev/null @@ -1,25 +0,0 @@ -name: Handle release PR title edits -on: - pull_request: - types: - - edited - - unlabeled - -jobs: - update_pr_content: - name: Update pull request content - if: | - ((github.event.action == 'edited' && github.event.changes.title.from != github.event.pull_request.title) || - (github.event.action == 'unlabeled' && github.event.label.name == 'autorelease: custom version')) && - startsWith(github.event.pull_request.head.ref, 'release-please--') && - github.event.pull_request.state == 'open' && - github.event.sender.login != 'stainless-bot' && - github.event.sender.login != 'stainless-app' && - github.repository == 'openlayer-ai/openlayer-go' - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: stainless-api/trigger-release-please@v1 - with: - repo: ${{ github.event.repository.full_name }} - stainless-api-key: ${{ secrets.STAINLESS_API_KEY }} diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 08e82c4..7e56fe2 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.1.0-alpha.15" + ".": "0.1.0-alpha.16" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index c254947..5fc516d 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1 +1,3 @@ configured_endpoints: 15 +openapi_spec_hash: 9a0b363025305f6b086bcdfe43274830 +config_hash: 21fb9730d1cdc9e3fd38724c4774b894 diff --git a/CHANGELOG.md b/CHANGELOG.md index 7085a40..26b1582 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,22 @@ # Changelog +## 0.1.0-alpha.16 (2025-04-03) + +Full Changelog: [v0.1.0-alpha.15...v0.1.0-alpha.16](https://github.com/openlayer-ai/openlayer-go/compare/v0.1.0-alpha.15...v0.1.0-alpha.16) + +### Bug Fixes + +* **client:** return error on bad custom url instead of panic ([#78](https://github.com/openlayer-ai/openlayer-go/issues/78)) ([7c32753](https://github.com/openlayer-ai/openlayer-go/commit/7c327533032a42dfeb762a95138e940deb636337)) +* **test:** return early after test failure ([#76](https://github.com/openlayer-ai/openlayer-go/issues/76)) ([e3db15b](https://github.com/openlayer-ai/openlayer-go/commit/e3db15bf6fc326d760dd2a3dec8c2a1557243bf4)) + + +### Chores + +* add request options to client tests ([#75](https://github.com/openlayer-ai/openlayer-go/issues/75)) ([47bbe8f](https://github.com/openlayer-ai/openlayer-go/commit/47bbe8f6fc702b16b17662158b89e447545834d5)) +* **docs:** improve security documentation ([#74](https://github.com/openlayer-ai/openlayer-go/issues/74)) ([ae864fb](https://github.com/openlayer-ai/openlayer-go/commit/ae864fbc0ac02aac9944cfde9974c1966a799871)) +* fix typos ([#77](https://github.com/openlayer-ai/openlayer-go/issues/77)) ([d5225a3](https://github.com/openlayer-ai/openlayer-go/commit/d5225a326c7781b7728234535403b76b2ef91a41)) +* **internal:** remove workflow ([466df7b](https://github.com/openlayer-ai/openlayer-go/commit/466df7bd80c4a89431d6f8db27bbac59b6b30dff)) + ## 0.1.0-alpha.15 (2025-03-14) Full Changelog: [v0.1.0-alpha.14...v0.1.0-alpha.15](https://github.com/openlayer-ai/openlayer-go/compare/v0.1.0-alpha.14...v0.1.0-alpha.15) diff --git a/README.md b/README.md index 2eaf480..6da5283 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ Or to pin the version: ```sh -go get -u 'github.com/openlayer-ai/openlayer-go@v0.1.0-alpha.15' +go get -u 'github.com/openlayer-ai/openlayer-go@v0.1.0-alpha.16' ``` diff --git a/client_test.go b/client_test.go index e498ab9..3487658 100644 --- a/client_test.go +++ b/client_test.go @@ -26,6 +26,7 @@ func (t *closureTransport) RoundTrip(req *http.Request) (*http.Response, error) func TestUserAgentHeader(t *testing.T) { var userAgent string client := openlayer.NewClient( + option.WithAPIKey("My API Key"), option.WithHTTPClient(&http.Client{ Transport: &closureTransport{ fn: func(req *http.Request) (*http.Response, error) { @@ -65,6 +66,7 @@ func TestUserAgentHeader(t *testing.T) { func TestRetryAfter(t *testing.T) { retryCountHeaders := make([]string, 0) client := openlayer.NewClient( + option.WithAPIKey("My API Key"), option.WithHTTPClient(&http.Client{ Transport: &closureTransport{ fn: func(req *http.Request) (*http.Response, error) { @@ -117,6 +119,7 @@ func TestRetryAfter(t *testing.T) { func TestDeleteRetryCountHeader(t *testing.T) { retryCountHeaders := make([]string, 0) client := openlayer.NewClient( + option.WithAPIKey("My API Key"), option.WithHTTPClient(&http.Client{ Transport: &closureTransport{ fn: func(req *http.Request) (*http.Response, error) { @@ -165,6 +168,7 @@ func TestDeleteRetryCountHeader(t *testing.T) { func TestOverwriteRetryCountHeader(t *testing.T) { retryCountHeaders := make([]string, 0) client := openlayer.NewClient( + option.WithAPIKey("My API Key"), option.WithHTTPClient(&http.Client{ Transport: &closureTransport{ fn: func(req *http.Request) (*http.Response, error) { @@ -213,6 +217,7 @@ func TestOverwriteRetryCountHeader(t *testing.T) { func TestRetryAfterMs(t *testing.T) { attempts := 0 client := openlayer.NewClient( + option.WithAPIKey("My API Key"), option.WithHTTPClient(&http.Client{ Transport: &closureTransport{ fn: func(req *http.Request) (*http.Response, error) { @@ -257,6 +262,7 @@ func TestRetryAfterMs(t *testing.T) { func TestContextCancel(t *testing.T) { client := openlayer.NewClient( + option.WithAPIKey("My API Key"), option.WithHTTPClient(&http.Client{ Transport: &closureTransport{ fn: func(req *http.Request) (*http.Response, error) { @@ -295,6 +301,7 @@ func TestContextCancel(t *testing.T) { func TestContextCancelDelay(t *testing.T) { client := openlayer.NewClient( + option.WithAPIKey("My API Key"), option.WithHTTPClient(&http.Client{ Transport: &closureTransport{ fn: func(req *http.Request) (*http.Response, error) { @@ -341,6 +348,7 @@ func TestContextDeadline(t *testing.T) { go func() { client := openlayer.NewClient( + option.WithAPIKey("My API Key"), option.WithHTTPClient(&http.Client{ Transport: &closureTransport{ fn: func(req *http.Request) (*http.Response, error) { diff --git a/internal/requestconfig/requestconfig.go b/internal/requestconfig/requestconfig.go index 9436270..902e94f 100644 --- a/internal/requestconfig/requestconfig.go +++ b/internal/requestconfig/requestconfig.go @@ -241,7 +241,7 @@ func shouldRetry(req *http.Request, res *http.Response) bool { return true } - // If the header explictly wants a retry behavior, respect that over the + // If the header explicitly wants a retry behavior, respect that over the // http status code. if res.Header.Get("x-should-retry") == "true" { return true diff --git a/internal/version.go b/internal/version.go index 13b9ceb..f578972 100644 --- a/internal/version.go +++ b/internal/version.go @@ -2,4 +2,4 @@ package internal -const PackageVersion = "0.1.0-alpha.15" // x-release-please-version +const PackageVersion = "0.1.0-alpha.16" // x-release-please-version diff --git a/option/requestoption.go b/option/requestoption.go index a8f530e..5c59183 100644 --- a/option/requestoption.go +++ b/option/requestoption.go @@ -6,7 +6,6 @@ import ( "bytes" "fmt" "io" - "log" "net/http" "net/url" "strings" @@ -24,12 +23,15 @@ import ( type RequestOption = requestconfig.RequestOption // WithBaseURL returns a RequestOption that sets the BaseURL for the client. +// +// For security reasons, ensure that the base URL is trusted. func WithBaseURL(base string) RequestOption { u, err := url.Parse(base) - if err != nil { - log.Fatalf("failed to parse BaseURL: %s\n", err) - } return requestconfig.RequestOptionFunc(func(r *requestconfig.RequestConfig) error { + if err != nil { + return fmt.Errorf("requestoption: WithBaseURL failed to parse url %s\n", err) + } + if u.Path != "" && !strings.HasSuffix(u.Path, "/") { u.Path += "/" } diff --git a/usage_test.go b/usage_test.go index 20d506e..76bc8ec 100644 --- a/usage_test.go +++ b/usage_test.go @@ -46,6 +46,7 @@ func TestUsage(t *testing.T) { ) if err != nil { t.Error(err) + return } t.Logf("%+v\n", response.Success) }