Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.
Ruby b2b-commercee-commerceecommerceecommerce-apiecommerce-frameworkecommerce-platformheadlessheadless-commerceheadless-ecommercemarketplacemulti-tenantmulti-vendormulti-vendor-ecommerceopen-sourcespree-commerce
Make all 2xx status codes a valid request response.
Sebastian Palmaf00beeccb23b
diff --git a/api/app/services/spree/webhooks/endpoints/make_request.rb b/api/app/services/spree/webhooks/endpoints/make_request.rbindex 8ec794873c..4c7c758833 100644--- a/api/app/services/spree/webhooks/endpoints/make_request.rb+++ b/api/app/services/spree/webhooks/endpoints/make_request.rb@@ -43,13 +43,13 @@ module Spreeenddef failed_request?- request_code_type != Net::HTTPOK+ !(request_code_type.in?(200...300))enddef request_code_typehttp = Net::HTTP.new(uri_host, uri_port)http.use_ssl = true unless Rails.env.development? || Rails.env.test?- http.request(request).code_type+ http.request(request).code.to_ienddef requestdiff --git a/api/spec/services/spree/webhooks/endpoints/make_request_spec.rb b/api/spec/services/spree/webhooks/endpoints/make_request_spec.rbindex 07b62d964f..3ad0ce07f7 100644--- a/api/spec/services/spree/webhooks/endpoints/make_request_spec.rb+++ b/api/spec/services/spree/webhooks/endpoints/make_request_spec.rb@@ -101,14 +101,14 @@ describe Spree::Webhooks::Endpoints::MakeRequest doendend- context 'when request code_type is not Net::HTTPOK' do+ context 'when request code_type is not 2xx' dobefore dohttp_double = instance_double(Net::HTTP)allow(Net::HTTP).to receive(:new).and_return(http_double)allow(http_double).to(receive(:request).and_return(double(:request).tap do |request|- allow(request).to receive(:code_type).and_return(Net::HTTPClientError)+ allow(request).to receive(:code).and_return("304")end))@@ -124,7 +124,7 @@ describe Spree::Webhooks::Endpoints::MakeRequest doit { expect(subject).to eq(nil) }end- context 'when request code_type is Net::HTTPOK' do+ context 'when request code_type is 2xx' doit 'debug logs after the request and returns its value' domessage = "[SPREE WEBHOOKS] 'order.cancel' success for URL 'http://google.com/'"expect(subject).to eq(Rails.logger.debug(message))