Skip to content

Commit

Permalink
preview version not needed anymore
Browse files Browse the repository at this point in the history
  • Loading branch information
ramya-stripe committed Sep 25, 2024
1 parent 2da2741 commit d5aebd4
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 9 deletions.
3 changes: 0 additions & 3 deletions lib/stripe/api_requestor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -457,9 +457,6 @@ def self.maybe_gc_connection_managers
base_address, params, opts, usage,
&read_body_chunk_block)
api_mode = Util.get_api_mode(path)
# Special handling for "Stripe-Version" header when api_mode is v2.
# Always use v2 API version unless explicitly overridden by the user.
opts[:stripe_version] = ApiVersion::PREVIEW if api_mode == :v2 && !opts.key?(:stripe_version)
opts = RequestOptions.merge_config_and_opts(config, opts)

raise ArgumentError, "method should be a symbol" \
Expand Down
2 changes: 1 addition & 1 deletion test/stripe/api_requestor_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,7 @@ class RequestorTest < Test::Unit::TestCase
Util.expects(:log_info).with("Request to Stripe API",
has_entries(config: kind_of(Stripe::StripeConfiguration),
account: nil,
api_version: Stripe::ApiVersion::PREVIEW,
api_version: Stripe::ApiVersion::CURRENT,
idempotency_key: nil,
method: :get,
num_retries: 0,
Expand Down
4 changes: 0 additions & 4 deletions test/stripe/raw_request_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ class RawRequestTest < Test::Unit::TestCase

assert_equal expected_body, resp.http_body
assert_equal "application/json", req.headers["Content-Type"]
assert_equal Stripe::ApiVersion::PREVIEW, req.headers["Stripe-Version"]
end

should "send post request with json body and headers and return a response" do
Expand All @@ -64,7 +63,6 @@ class RawRequestTest < Test::Unit::TestCase

assert_equal expected_body, resp.http_body
assert_equal "application/json", req.headers["Content-Type"]
assert_equal Stripe::ApiVersion::PREVIEW, req.headers["Stripe-Version"]
assert_equal "bar", req.headers["Stripe-Context"]
end

Expand All @@ -91,8 +89,6 @@ class RawRequestTest < Test::Unit::TestCase
.to_return(body: expected_body)

Stripe.raw_request(:get, "/v2/core/events/evt_123")

assert_equal Stripe::ApiVersion::PREVIEW, req.headers["Stripe-Version"]
end

should "allow overriding stripe version for v2 endpoints" do
Expand Down
1 change: 0 additions & 1 deletion test/stripe/stripe_client_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ class StripeClientTest < Test::Unit::TestCase
resp = client.v2.core.events.retrieve("evt_123")

assert_equal nil, req.headers["Content-Type"]
assert_equal Stripe::ApiVersion::PREVIEW, req.headers["Stripe-Version"]

assert resp.is_a?(Stripe::V2::Event)
assert_equal "sk_test_123", resp.instance_variable_get(:@opts)[:api_key]
Expand Down

0 comments on commit d5aebd4

Please sign in to comment.