diff --git a/lib/action_push_native/service/apns.rb b/lib/action_push_native/service/apns.rb index 6c905ea..b0531d9 100644 --- a/lib/action_push_native/service/apns.rb +++ b/lib/action_push_native/service/apns.rb @@ -15,7 +15,7 @@ def push(notification) headers, payload = headers_from(notification), payload_from(notification) Rails.logger.info("Pushing APNs notification: #{headers[:"apns-id"]}") - response = httpx_session.post("https://api.push.apple.com/3/device/#{notification.token}", json: payload, headers: headers) + response = httpx_session.post("3/device/#{notification.token}", json: payload, headers: headers) handle_error(response) if response.error end diff --git a/test/lib/action_push_native/service/apns_test.rb b/test/lib/action_push_native/service/apns_test.rb index 3f064a5..2d9a2fb 100644 --- a/test/lib/action_push_native/service/apns_test.rb +++ b/test/lib/action_push_native/service/apns_test.rb @@ -171,6 +171,12 @@ class ApnsTest < ActiveSupport::TestCase end end + test "connect to APNs development server" do + apns = Apns.new(@config.merge(connect_to_development_server: true)) + stub_request(:post, "https://api.sandbox.push.apple.com/3/device/123").to_return(status: 200) + assert_nothing_raised { apns.push(@notification) } + end + private def build_notification ActionPushNative::Notification