Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(next => main): release 0.7.2 #121

Merged
merged 3 commits into from
Sep 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.7.1"
".": "0.7.2"
}
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# Changelog

## 0.7.2 (2023-09-12)

Full Changelog: [v0.7.1...v0.7.2](https://github.com/lithic-com/lithic-go/compare/v0.7.1...v0.7.2)

### Bug Fixes

* **core:** add null check to prevent segfault when canceling context ([#120](https://github.com/lithic-com/lithic-go/issues/120)) ([91276bc](https://github.com/lithic-com/lithic-go/commit/91276bcc574b4e5c2ffe1c3501142974b7b95dde))


### Chores

* **internal:** improve reliability of cancel delay test ([#122](https://github.com/lithic-com/lithic-go/issues/122)) ([69cbd7c](https://github.com/lithic-com/lithic-go/commit/69cbd7cb296670f4faf85da170e709ece9e2d4ad))

## 0.7.1 (2023-09-11)

Full Changelog: [v0.7.0...v0.7.1](https://github.com/lithic-com/lithic-go/compare/v0.7.0...v0.7.1)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Or to pin the version:
<!-- x-release-please-start-version -->

```sh
go get -u 'github.com/lithic-com/[email protected].1'
go get -u 'github.com/lithic-com/[email protected].2'
```

<!-- x-release-please-end -->
Expand Down
55 changes: 55 additions & 0 deletions client_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
// File generated from our OpenAPI spec by Stainless.

package lithic_test

import (
"context"
"fmt"
"net/http"
"testing"
"time"

"github.com/lithic-com/lithic-go"
"github.com/lithic-com/lithic-go/option"
)

func TestCancel(t *testing.T) {
client := lithic.NewClient(
option.WithBaseURL("http://127.0.0.1:4010"),
option.WithAPIKey("APIKey"),
)
cancelCtx, cancel := context.WithCancel(context.Background())
cancel()
res, err := client.Cards.New(cancelCtx, lithic.CardNewParams{
Type: lithic.F(lithic.CardNewParamsTypeSingleUse),
})
if err == nil || res != nil {
t.Error("Expected there to be a cancel error and for the response to be nil")
}
}

type neverTransport struct{}

func (t *neverTransport) RoundTrip(req *http.Request) (*http.Response, error) {
<-req.Context().Done()
return nil, fmt.Errorf("cancelled")
}

func TestCancelDelay(t *testing.T) {
client := lithic.NewClient(
option.WithBaseURL("http://127.0.0.1:4010"),
option.WithAPIKey("APIKey"),
option.WithHTTPClient(&http.Client{Transport: &neverTransport{}}),
)
cancelCtx, cancel := context.WithCancel(context.Background())
go func() {
time.Sleep(time.Millisecond * time.Duration(2))
cancel()
}()
res, err := client.Cards.New(cancelCtx, lithic.CardNewParams{
Type: lithic.F(lithic.CardNewParamsTypeSingleUse),
})
if err == nil || res != nil {
t.Error("Expected there to be a cancel error and for the response to be nil")
}
}
3 changes: 3 additions & 0 deletions internal/requestconfig/requestconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,9 @@ func (cfg *RequestConfig) Execute() error {

req := cfg.Request.Clone(ctx)
res, err = handler(req)
if res == nil {
break
}

shouldRetry := err != nil ||
res.StatusCode == http.StatusConflict ||
Expand Down
2 changes: 1 addition & 1 deletion internal/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

package internal

const PackageVersion = "0.7.1" // x-release-please-version
const PackageVersion = "0.7.2" // x-release-please-version