From 50711763c0f3bee01b36ab00500db61aa371415b Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 4 Feb 2026 18:05:28 +0000 Subject: [PATCH 1/8] chore(internal): codegen related update --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index f306eb5..2f9a95a 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/imagekit-developer/imagekit-go/v2 go 1.22 require ( - github.com/standard-webhooks/standard-webhooks/libraries v0.0.0-20260114220421-3f69fd681bb0 + github.com/standard-webhooks/standard-webhooks/libraries v0.0.0-20260204153508-82e3cc7ca7f2 github.com/tidwall/gjson v1.18.0 github.com/tidwall/sjson v1.2.5 ) diff --git a/go.sum b/go.sum index b09e3fe..b63fcd6 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,5 @@ -github.com/standard-webhooks/standard-webhooks/libraries v0.0.0-20260114220421-3f69fd681bb0 h1:EZXYkItlI9VXF+3x/VFkP8JKa6ibJVZAMjHGfdjzHC8= -github.com/standard-webhooks/standard-webhooks/libraries v0.0.0-20260114220421-3f69fd681bb0/go.mod h1:L1MQhA6x4dn9r007T033lsaZMv9EmBAdXyU/+EF40fo= +github.com/standard-webhooks/standard-webhooks/libraries v0.0.0-20260204153508-82e3cc7ca7f2 h1:G8HmTGjWol06WYFuaB92Ii9WVd6/IRBkmAyc4OrmN8Y= +github.com/standard-webhooks/standard-webhooks/libraries v0.0.0-20260204153508-82e3cc7ca7f2/go.mod h1:L1MQhA6x4dn9r007T033lsaZMv9EmBAdXyU/+EF40fo= github.com/tidwall/gjson v1.14.2/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= github.com/tidwall/gjson v1.18.0 h1:FIDeeyB800efLX89e5a8Y0BNH+LOngJyGrIWxG2FKQY= github.com/tidwall/gjson v1.18.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= From c8a223a358428b56cd5f13843928252c58acff90 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 10 Feb 2026 20:27:07 +0000 Subject: [PATCH 2/8] fix(encoder): correctly serialize NullStruct --- packages/param/encoder.go | 3 +++ packages/param/encoder_test.go | 12 ++++++++++++ 2 files changed, 15 insertions(+) diff --git a/packages/param/encoder.go b/packages/param/encoder.go index b0410be..631e780 100644 --- a/packages/param/encoder.go +++ b/packages/param/encoder.go @@ -83,6 +83,9 @@ func MarshalUnion[T ParamStruct](metadata T, variants ...any) ([]byte, error) { } } if nPresent == 0 || presentIdx == -1 { + if metadata.null() { + return []byte("null"), nil + } if ovr, ok := metadata.Overrides(); ok { return shimjson.Marshal(ovr) } diff --git a/packages/param/encoder_test.go b/packages/param/encoder_test.go index a86612f..eed22a0 100644 --- a/packages/param/encoder_test.go +++ b/packages/param/encoder_test.go @@ -363,3 +363,15 @@ func TestOverriddenUnion(t *testing.T) { }) } } + +func TestNullStructUnion(t *testing.T) { + nullUnion := param.NullStruct[PrimitiveUnion]() + + b, err := json.Marshal(nullUnion) + if err != nil { + t.Fatalf("didn't expect error %v", err) + } + if string(b) != "null" { + t.Fatalf("expected null, received %s", string(b)) + } +} From e1e47559733779920f899cb665b244e431702668 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 18 Feb 2026 16:57:18 +0000 Subject: [PATCH 3/8] chore(internal): codegen related update --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 2f9a95a..eb997d7 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/imagekit-developer/imagekit-go/v2 go 1.22 require ( - github.com/standard-webhooks/standard-webhooks/libraries v0.0.0-20260204153508-82e3cc7ca7f2 + github.com/standard-webhooks/standard-webhooks/libraries v0.0.0-20260218155026-c54c4d7dd7af github.com/tidwall/gjson v1.18.0 github.com/tidwall/sjson v1.2.5 ) diff --git a/go.sum b/go.sum index b63fcd6..3d177e9 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,5 @@ -github.com/standard-webhooks/standard-webhooks/libraries v0.0.0-20260204153508-82e3cc7ca7f2 h1:G8HmTGjWol06WYFuaB92Ii9WVd6/IRBkmAyc4OrmN8Y= -github.com/standard-webhooks/standard-webhooks/libraries v0.0.0-20260204153508-82e3cc7ca7f2/go.mod h1:L1MQhA6x4dn9r007T033lsaZMv9EmBAdXyU/+EF40fo= +github.com/standard-webhooks/standard-webhooks/libraries v0.0.0-20260218155026-c54c4d7dd7af h1:N6tWCzt92IpTWj/jB96BLH4FPkEwL4MzWMOlF69Ra+o= +github.com/standard-webhooks/standard-webhooks/libraries v0.0.0-20260218155026-c54c4d7dd7af/go.mod h1:L1MQhA6x4dn9r007T033lsaZMv9EmBAdXyU/+EF40fo= github.com/tidwall/gjson v1.14.2/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= github.com/tidwall/gjson v1.18.0 h1:FIDeeyB800efLX89e5a8Y0BNH+LOngJyGrIWxG2FKQY= github.com/tidwall/gjson v1.18.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= From 255a0313de39110cdedc4002d451bdc39e3bc308 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 18 Feb 2026 19:32:21 +0000 Subject: [PATCH 4/8] chore(internal): codegen related update --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index eb997d7..69e4a1a 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/imagekit-developer/imagekit-go/v2 go 1.22 require ( - github.com/standard-webhooks/standard-webhooks/libraries v0.0.0-20260218155026-c54c4d7dd7af + github.com/standard-webhooks/standard-webhooks/libraries v0.0.0-20260218190227-a1773d7ffc57 github.com/tidwall/gjson v1.18.0 github.com/tidwall/sjson v1.2.5 ) diff --git a/go.sum b/go.sum index 3d177e9..796f80d 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,5 @@ -github.com/standard-webhooks/standard-webhooks/libraries v0.0.0-20260218155026-c54c4d7dd7af h1:N6tWCzt92IpTWj/jB96BLH4FPkEwL4MzWMOlF69Ra+o= -github.com/standard-webhooks/standard-webhooks/libraries v0.0.0-20260218155026-c54c4d7dd7af/go.mod h1:L1MQhA6x4dn9r007T033lsaZMv9EmBAdXyU/+EF40fo= +github.com/standard-webhooks/standard-webhooks/libraries v0.0.0-20260218190227-a1773d7ffc57 h1:Tyc4ahpgMG94JVYI31kubJ7+W/GQIfXW3Oyrp3nzoeE= +github.com/standard-webhooks/standard-webhooks/libraries v0.0.0-20260218190227-a1773d7ffc57/go.mod h1:L1MQhA6x4dn9r007T033lsaZMv9EmBAdXyU/+EF40fo= github.com/tidwall/gjson v1.14.2/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= github.com/tidwall/gjson v1.18.0 h1:FIDeeyB800efLX89e5a8Y0BNH+LOngJyGrIWxG2FKQY= github.com/tidwall/gjson v1.18.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= From ab007f7fa428ff639b7c1177976d76b4c66eb5f5 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 19 Feb 2026 16:03:16 +0000 Subject: [PATCH 5/8] chore(internal): remove mock server code --- scripts/mock | 41 ----------------------------------------- scripts/test | 46 ---------------------------------------------- 2 files changed, 87 deletions(-) delete mode 100755 scripts/mock diff --git a/scripts/mock b/scripts/mock deleted file mode 100755 index 0b28f6e..0000000 --- a/scripts/mock +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/bin/env bash - -set -e - -cd "$(dirname "$0")/.." - -if [[ -n "$1" && "$1" != '--'* ]]; then - URL="$1" - shift -else - URL="$(grep 'openapi_spec_url' .stats.yml | cut -d' ' -f2)" -fi - -# Check if the URL is empty -if [ -z "$URL" ]; then - echo "Error: No OpenAPI spec path/url provided or found in .stats.yml" - exit 1 -fi - -echo "==> Starting mock server with URL ${URL}" - -# Run prism mock on the given spec -if [ "$1" == "--daemon" ]; then - npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock "$URL" &> .prism.log & - - # Wait for server to come online - echo -n "Waiting for server" - while ! grep -q "✖ fatal\|Prism is listening" ".prism.log" ; do - echo -n "." - sleep 0.1 - done - - if grep -q "✖ fatal" ".prism.log"; then - cat .prism.log - exit 1 - fi - - echo -else - npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock "$URL" -fi diff --git a/scripts/test b/scripts/test index c26b122..8704b64 100755 --- a/scripts/test +++ b/scripts/test @@ -4,53 +4,7 @@ set -e cd "$(dirname "$0")/.." -RED='\033[0;31m' -GREEN='\033[0;32m' -YELLOW='\033[0;33m' -NC='\033[0m' # No Color -function prism_is_running() { - curl --silent "http://localhost:4010" >/dev/null 2>&1 -} - -kill_server_on_port() { - pids=$(lsof -t -i tcp:"$1" || echo "") - if [ "$pids" != "" ]; then - kill "$pids" - echo "Stopped $pids." - fi -} - -function is_overriding_api_base_url() { - [ -n "$TEST_API_BASE_URL" ] -} - -if ! is_overriding_api_base_url && ! prism_is_running ; then - # When we exit this script, make sure to kill the background mock server process - trap 'kill_server_on_port 4010' EXIT - - # Start the dev server - ./scripts/mock --daemon -fi - -if is_overriding_api_base_url ; then - echo -e "${GREEN}✔ Running tests against ${TEST_API_BASE_URL}${NC}" - echo -elif ! prism_is_running ; then - echo -e "${RED}ERROR:${NC} The test suite will not run without a mock Prism server" - echo -e "running against your OpenAPI spec." - echo - echo -e "To run the server, pass in the path or url of your OpenAPI" - echo -e "spec to the prism command:" - echo - echo -e " \$ ${YELLOW}npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock path/to/your.openapi.yml${NC}" - echo - - exit 1 -else - echo -e "${GREEN}✔ Mock prism server is running with your OpenAPI spec${NC}" - echo -fi echo "==> Running tests" go test ./... "$@" From 1ba9e87f6b30e3992999808434dd39298de4d0a0 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 19 Feb 2026 16:33:35 +0000 Subject: [PATCH 6/8] chore: update mock server docs --- CONTRIBUTING.md | 7 ------- accountorigin_test.go | 10 +++++----- accounturlendpoint_test.go | 10 +++++----- accountusage_test.go | 2 +- asset_test.go | 2 +- betav2file_test.go | 2 +- cacheinvalidation_test.go | 4 ++-- custommetadatafield_test.go | 8 ++++---- dummy_test.go | 2 +- file_test.go | 14 +++++++------- filebulk_test.go | 8 ++++---- filemetadata_test.go | 4 ++-- fileversion_test.go | 8 ++++---- folder_test.go | 10 +++++----- folderjob_test.go | 2 +- internal/testutil/testutil.go | 4 ++-- savedextension_test.go | 10 +++++----- usage_test.go | 2 +- 18 files changed, 51 insertions(+), 58 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 0635957..00f7743 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -46,13 +46,6 @@ $ go mod edit -replace github.com/imagekit-developer/imagekit-go=/path/to/imagek ## Running tests -Most tests require you to [set up a mock server](https://github.com/stoplightio/prism) against the OpenAPI spec to run the tests. - -```sh -# you will need npm installed -$ npx prism mock path/to/your/openapi.yml -``` - ```sh $ ./scripts/test ``` diff --git a/accountorigin_test.go b/accountorigin_test.go index 350726b..3161145 100644 --- a/accountorigin_test.go +++ b/accountorigin_test.go @@ -14,7 +14,7 @@ import ( ) func TestAccountOriginNewWithOptionalParams(t *testing.T) { - t.Skip("Prism tests are disabled") + t.Skip("Mock server tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -50,7 +50,7 @@ func TestAccountOriginNewWithOptionalParams(t *testing.T) { } func TestAccountOriginUpdateWithOptionalParams(t *testing.T) { - t.Skip("Prism tests are disabled") + t.Skip("Mock server tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -90,7 +90,7 @@ func TestAccountOriginUpdateWithOptionalParams(t *testing.T) { } func TestAccountOriginList(t *testing.T) { - t.Skip("Prism tests are disabled") + t.Skip("Mock server tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -114,7 +114,7 @@ func TestAccountOriginList(t *testing.T) { } func TestAccountOriginDelete(t *testing.T) { - t.Skip("Prism tests are disabled") + t.Skip("Mock server tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -138,7 +138,7 @@ func TestAccountOriginDelete(t *testing.T) { } func TestAccountOriginGet(t *testing.T) { - t.Skip("Prism tests are disabled") + t.Skip("Mock server tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/accounturlendpoint_test.go b/accounturlendpoint_test.go index 06c9c66..716ef33 100644 --- a/accounturlendpoint_test.go +++ b/accounturlendpoint_test.go @@ -14,7 +14,7 @@ import ( ) func TestAccountURLEndpointNewWithOptionalParams(t *testing.T) { - t.Skip("Prism tests are disabled") + t.Skip("Mock server tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -49,7 +49,7 @@ func TestAccountURLEndpointNewWithOptionalParams(t *testing.T) { } func TestAccountURLEndpointUpdateWithOptionalParams(t *testing.T) { - t.Skip("Prism tests are disabled") + t.Skip("Mock server tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -88,7 +88,7 @@ func TestAccountURLEndpointUpdateWithOptionalParams(t *testing.T) { } func TestAccountURLEndpointList(t *testing.T) { - t.Skip("Prism tests are disabled") + t.Skip("Mock server tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -112,7 +112,7 @@ func TestAccountURLEndpointList(t *testing.T) { } func TestAccountURLEndpointDelete(t *testing.T) { - t.Skip("Prism tests are disabled") + t.Skip("Mock server tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -136,7 +136,7 @@ func TestAccountURLEndpointDelete(t *testing.T) { } func TestAccountURLEndpointGet(t *testing.T) { - t.Skip("Prism tests are disabled") + t.Skip("Mock server tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/accountusage_test.go b/accountusage_test.go index a206f36..dcfd282 100644 --- a/accountusage_test.go +++ b/accountusage_test.go @@ -15,7 +15,7 @@ import ( ) func TestAccountUsageGet(t *testing.T) { - t.Skip("Prism tests are disabled") + t.Skip("Mock server tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/asset_test.go b/asset_test.go index d479ff3..f1fd203 100644 --- a/asset_test.go +++ b/asset_test.go @@ -14,7 +14,7 @@ import ( ) func TestAssetListWithOptionalParams(t *testing.T) { - t.Skip("Prism tests are disabled") + t.Skip("Mock server tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/betav2file_test.go b/betav2file_test.go index 8f52587..029636d 100644 --- a/betav2file_test.go +++ b/betav2file_test.go @@ -17,7 +17,7 @@ import ( ) func TestBetaV2FileUploadWithOptionalParams(t *testing.T) { - t.Skip("Prism tests are disabled") + t.Skip("Mock server tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/cacheinvalidation_test.go b/cacheinvalidation_test.go index 2e12514..ac4ecc1 100644 --- a/cacheinvalidation_test.go +++ b/cacheinvalidation_test.go @@ -14,7 +14,7 @@ import ( ) func TestCacheInvalidationNew(t *testing.T) { - t.Skip("Prism tests are disabled") + t.Skip("Mock server tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -40,7 +40,7 @@ func TestCacheInvalidationNew(t *testing.T) { } func TestCacheInvalidationGet(t *testing.T) { - t.Skip("Prism tests are disabled") + t.Skip("Mock server tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/custommetadatafield_test.go b/custommetadatafield_test.go index c3cb073..ca9bbbc 100644 --- a/custommetadatafield_test.go +++ b/custommetadatafield_test.go @@ -14,7 +14,7 @@ import ( ) func TestCustomMetadataFieldNewWithOptionalParams(t *testing.T) { - t.Skip("Prism tests are disabled") + t.Skip("Mock server tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -69,7 +69,7 @@ func TestCustomMetadataFieldNewWithOptionalParams(t *testing.T) { } func TestCustomMetadataFieldUpdateWithOptionalParams(t *testing.T) { - t.Skip("Prism tests are disabled") + t.Skip("Mock server tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -126,7 +126,7 @@ func TestCustomMetadataFieldUpdateWithOptionalParams(t *testing.T) { } func TestCustomMetadataFieldListWithOptionalParams(t *testing.T) { - t.Skip("Prism tests are disabled") + t.Skip("Mock server tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -153,7 +153,7 @@ func TestCustomMetadataFieldListWithOptionalParams(t *testing.T) { } func TestCustomMetadataFieldDelete(t *testing.T) { - t.Skip("Prism tests are disabled") + t.Skip("Mock server tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/dummy_test.go b/dummy_test.go index 2ffd02b..d1c6dfd 100644 --- a/dummy_test.go +++ b/dummy_test.go @@ -16,7 +16,7 @@ import ( ) func TestDummyNewWithOptionalParams(t *testing.T) { - t.Skip("Prism tests are disabled") + t.Skip("Mock server tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/file_test.go b/file_test.go index 6b57c74..3927aa2 100644 --- a/file_test.go +++ b/file_test.go @@ -17,7 +17,7 @@ import ( ) func TestFileUpdateWithOptionalParams(t *testing.T) { - t.Skip("Prism tests are disabled") + t.Skip("Mock server tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -100,7 +100,7 @@ func TestFileUpdateWithOptionalParams(t *testing.T) { } func TestFileDelete(t *testing.T) { - t.Skip("Prism tests are disabled") + t.Skip("Mock server tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -124,7 +124,7 @@ func TestFileDelete(t *testing.T) { } func TestFileCopyWithOptionalParams(t *testing.T) { - t.Skip("Prism tests are disabled") + t.Skip("Mock server tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -152,7 +152,7 @@ func TestFileCopyWithOptionalParams(t *testing.T) { } func TestFileGet(t *testing.T) { - t.Skip("Prism tests are disabled") + t.Skip("Mock server tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -176,7 +176,7 @@ func TestFileGet(t *testing.T) { } func TestFileMove(t *testing.T) { - t.Skip("Prism tests are disabled") + t.Skip("Mock server tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -203,7 +203,7 @@ func TestFileMove(t *testing.T) { } func TestFileRenameWithOptionalParams(t *testing.T) { - t.Skip("Prism tests are disabled") + t.Skip("Mock server tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -231,7 +231,7 @@ func TestFileRenameWithOptionalParams(t *testing.T) { } func TestFileUploadWithOptionalParams(t *testing.T) { - t.Skip("Prism tests are disabled") + t.Skip("Mock server tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/filebulk_test.go b/filebulk_test.go index 1cb0db1..5da35a6 100644 --- a/filebulk_test.go +++ b/filebulk_test.go @@ -14,7 +14,7 @@ import ( ) func TestFileBulkDelete(t *testing.T) { - t.Skip("Prism tests are disabled") + t.Skip("Mock server tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -40,7 +40,7 @@ func TestFileBulkDelete(t *testing.T) { } func TestFileBulkAddTags(t *testing.T) { - t.Skip("Prism tests are disabled") + t.Skip("Mock server tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -67,7 +67,7 @@ func TestFileBulkAddTags(t *testing.T) { } func TestFileBulkRemoveAITags(t *testing.T) { - t.Skip("Prism tests are disabled") + t.Skip("Mock server tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -94,7 +94,7 @@ func TestFileBulkRemoveAITags(t *testing.T) { } func TestFileBulkRemoveTags(t *testing.T) { - t.Skip("Prism tests are disabled") + t.Skip("Mock server tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/filemetadata_test.go b/filemetadata_test.go index 0245da8..d5f2771 100644 --- a/filemetadata_test.go +++ b/filemetadata_test.go @@ -14,7 +14,7 @@ import ( ) func TestFileMetadataGet(t *testing.T) { - t.Skip("Prism tests are disabled") + t.Skip("Mock server tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -38,7 +38,7 @@ func TestFileMetadataGet(t *testing.T) { } func TestFileMetadataGetFromURL(t *testing.T) { - t.Skip("Prism tests are disabled") + t.Skip("Mock server tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/fileversion_test.go b/fileversion_test.go index e6d5499..80d6d42 100644 --- a/fileversion_test.go +++ b/fileversion_test.go @@ -14,7 +14,7 @@ import ( ) func TestFileVersionList(t *testing.T) { - t.Skip("Prism tests are disabled") + t.Skip("Mock server tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -38,7 +38,7 @@ func TestFileVersionList(t *testing.T) { } func TestFileVersionDelete(t *testing.T) { - t.Skip("Prism tests are disabled") + t.Skip("Mock server tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -68,7 +68,7 @@ func TestFileVersionDelete(t *testing.T) { } func TestFileVersionGet(t *testing.T) { - t.Skip("Prism tests are disabled") + t.Skip("Mock server tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -98,7 +98,7 @@ func TestFileVersionGet(t *testing.T) { } func TestFileVersionRestore(t *testing.T) { - t.Skip("Prism tests are disabled") + t.Skip("Mock server tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/folder_test.go b/folder_test.go index b891101..ec03029 100644 --- a/folder_test.go +++ b/folder_test.go @@ -14,7 +14,7 @@ import ( ) func TestFolderNew(t *testing.T) { - t.Skip("Prism tests are disabled") + t.Skip("Mock server tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -41,7 +41,7 @@ func TestFolderNew(t *testing.T) { } func TestFolderDelete(t *testing.T) { - t.Skip("Prism tests are disabled") + t.Skip("Mock server tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -67,7 +67,7 @@ func TestFolderDelete(t *testing.T) { } func TestFolderCopyWithOptionalParams(t *testing.T) { - t.Skip("Prism tests are disabled") + t.Skip("Mock server tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -95,7 +95,7 @@ func TestFolderCopyWithOptionalParams(t *testing.T) { } func TestFolderMove(t *testing.T) { - t.Skip("Prism tests are disabled") + t.Skip("Mock server tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -122,7 +122,7 @@ func TestFolderMove(t *testing.T) { } func TestFolderRenameWithOptionalParams(t *testing.T) { - t.Skip("Prism tests are disabled") + t.Skip("Mock server tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/folderjob_test.go b/folderjob_test.go index a4c9541..f03c188 100644 --- a/folderjob_test.go +++ b/folderjob_test.go @@ -14,7 +14,7 @@ import ( ) func TestFolderJobGet(t *testing.T) { - t.Skip("Prism tests are disabled") + t.Skip("Mock server tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/internal/testutil/testutil.go b/internal/testutil/testutil.go index 826d266..31103e9 100644 --- a/internal/testutil/testutil.go +++ b/internal/testutil/testutil.go @@ -16,10 +16,10 @@ func CheckTestServer(t *testing.T, url string) bool { t.Fatalf("strconv.ParseBool(os.LookupEnv(%s)) failed: %s", SKIP_MOCK_TESTS, err) } if skip { - t.Skip("The test will not run without a mock Prism server running against your OpenAPI spec") + t.Skip("The test will not run without a mock server running against your OpenAPI spec") return false } - t.Errorf("The test will not run without a mock Prism server running against your OpenAPI spec. You can set the environment variable %s to true to skip running any tests that require the mock server", SKIP_MOCK_TESTS) + t.Errorf("The test will not run without a mock server running against your OpenAPI spec. You can set the environment variable %s to true to skip running any tests that require the mock server", SKIP_MOCK_TESTS) return false } } diff --git a/savedextension_test.go b/savedextension_test.go index effbeaf..1149d86 100644 --- a/savedextension_test.go +++ b/savedextension_test.go @@ -15,7 +15,7 @@ import ( ) func TestSavedExtensionNewWithOptionalParams(t *testing.T) { - t.Skip("Prism tests are disabled") + t.Skip("Mock server tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -52,7 +52,7 @@ func TestSavedExtensionNewWithOptionalParams(t *testing.T) { } func TestSavedExtensionUpdateWithOptionalParams(t *testing.T) { - t.Skip("Prism tests are disabled") + t.Skip("Mock server tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -93,7 +93,7 @@ func TestSavedExtensionUpdateWithOptionalParams(t *testing.T) { } func TestSavedExtensionList(t *testing.T) { - t.Skip("Prism tests are disabled") + t.Skip("Mock server tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -117,7 +117,7 @@ func TestSavedExtensionList(t *testing.T) { } func TestSavedExtensionDelete(t *testing.T) { - t.Skip("Prism tests are disabled") + t.Skip("Mock server tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL @@ -141,7 +141,7 @@ func TestSavedExtensionDelete(t *testing.T) { } func TestSavedExtensionGet(t *testing.T) { - t.Skip("Prism tests are disabled") + t.Skip("Mock server tests are disabled") baseURL := "http://localhost:4010" if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { baseURL = envURL diff --git a/usage_test.go b/usage_test.go index 6792db9..7101623 100644 --- a/usage_test.go +++ b/usage_test.go @@ -27,7 +27,7 @@ func TestUsage(t *testing.T) { option.WithPrivateKey("My Private Key"), option.WithPassword("My Password"), ) - t.Skip("Prism tests are disabled") + t.Skip("Mock server tests are disabled") response, err := client.Files.Upload(context.TODO(), imagekit.FileUploadParams{ File: io.Reader(bytes.NewBuffer([]byte("https://www.example.com/public-url.jpg"))), FileName: "file-name.jpg", From c772a06aa381125614083d572ce99b73b4eb3ce5 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 19 Feb 2026 22:43:08 +0000 Subject: [PATCH 7/8] fix: allow canceling a request while it is waiting to retry --- internal/requestconfig/requestconfig.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/internal/requestconfig/requestconfig.go b/internal/requestconfig/requestconfig.go index 75e05ff..923e9f5 100644 --- a/internal/requestconfig/requestconfig.go +++ b/internal/requestconfig/requestconfig.go @@ -468,7 +468,11 @@ func (cfg *RequestConfig) Execute() (err error) { res.Body.Close() } - time.Sleep(retryDelay(res, retryCount)) + select { + case <-ctx.Done(): + return ctx.Err() + case <-time.After(retryDelay(res, retryCount)): + } } // Save *http.Response if it is requested to, even if there was an error making the request. This is From e702dbc475fd0c7a2f1c6dbdf5c28803d0575515 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 19 Feb 2026 22:43:25 +0000 Subject: [PATCH 8/8] release: 2.2.1 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 18 ++++++++++++++++++ README.md | 2 +- internal/version.go | 2 +- 4 files changed, 21 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index bfc26f9..89d8ff8 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "2.2.0" + ".": "2.2.1" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 6a9b04c..c0b3687 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,23 @@ # Changelog +## 2.2.1 (2026-02-19) + +Full Changelog: [v2.2.0...v2.2.1](https://github.com/imagekit-developer/imagekit-go/compare/v2.2.0...v2.2.1) + +### Bug Fixes + +* allow canceling a request while it is waiting to retry ([c772a06](https://github.com/imagekit-developer/imagekit-go/commit/c772a06aa381125614083d572ce99b73b4eb3ce5)) +* **encoder:** correctly serialize NullStruct ([c8a223a](https://github.com/imagekit-developer/imagekit-go/commit/c8a223a358428b56cd5f13843928252c58acff90)) + + +### Chores + +* **internal:** codegen related update ([255a031](https://github.com/imagekit-developer/imagekit-go/commit/255a0313de39110cdedc4002d451bdc39e3bc308)) +* **internal:** codegen related update ([e1e4755](https://github.com/imagekit-developer/imagekit-go/commit/e1e47559733779920f899cb665b244e431702668)) +* **internal:** codegen related update ([5071176](https://github.com/imagekit-developer/imagekit-go/commit/50711763c0f3bee01b36ab00500db61aa371415b)) +* **internal:** remove mock server code ([ab007f7](https://github.com/imagekit-developer/imagekit-go/commit/ab007f7fa428ff639b7c1177976d76b4c66eb5f5)) +* update mock server docs ([1ba9e87](https://github.com/imagekit-developer/imagekit-go/commit/1ba9e87f6b30e3992999808434dd39298de4d0a0)) + ## 2.2.0 (2026-02-02) Full Changelog: [v2.1.1...v2.2.0](https://github.com/imagekit-developer/imagekit-go/compare/v2.1.1...v2.2.0) diff --git a/README.md b/README.md index ffc95e0..57a1c28 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,7 @@ Or to pin the version: ```sh -go get -u 'github.com/imagekit-developer/imagekit-go/v2@v2.2.0' +go get -u 'github.com/imagekit-developer/imagekit-go/v2@v2.2.1' ``` diff --git a/internal/version.go b/internal/version.go index 0759deb..3d559d4 100644 --- a/internal/version.go +++ b/internal/version.go @@ -2,4 +2,4 @@ package internal -const PackageVersion = "2.2.0" // x-release-please-version +const PackageVersion = "2.2.1" // x-release-please-version