Skip to content

Commit

Permalink
Fix sinatra 4.1 host authorization
Browse files Browse the repository at this point in the history
  • Loading branch information
robertomiranda committed Dec 4, 2024
1 parent fb5c94e commit 80ba4c0
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
6 changes: 3 additions & 3 deletions test/avro_deserializer_test.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
require "test_helper"
require "avro_turf/test/fake_confluent_schema_registry_server"
require_relative "support/authorized_fake_confluent_schema_registry_server"
require "webmock/minitest"
require "ostruct"

Expand All @@ -9,8 +9,8 @@ def setup
Streamy.configuration.avro_schema_registry_url = "http://registry.example.com"
Streamy.configuration.avro_schemas_path = "test/fixtures/schemas"
Serializers::AvroSerializer.clear_messaging_cache
FakeConfluentSchemaRegistryServer.clear
stub_request(:any, /^#{Streamy.configuration.avro_schema_registry_url}/).to_rack(FakeConfluentSchemaRegistryServer)
stub_request(:any, /^#{Streamy.configuration.avro_schema_registry_url}/).to_rack(AuthorizedFakeConfluentSchemaRegistryServer)
AuthorizedFakeConfluentSchemaRegistryServer.clear
end

class TestEvent < AvroEvent
Expand Down
6 changes: 3 additions & 3 deletions test/avro_event_test.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
require "test_helper"
require "avro_turf/test/fake_confluent_schema_registry_server"
require_relative "support/authorized_fake_confluent_schema_registry_server"
require "webmock/minitest"

module Streamy
Expand All @@ -8,8 +8,8 @@ def setup
Streamy.configuration.avro_schema_registry_url = "http://registry.example.com"
Streamy.configuration.avro_schemas_path = "test/fixtures/schemas"
Serializers::AvroSerializer.clear_messaging_cache
FakeConfluentSchemaRegistryServer.clear
stub_request(:any, /^#{Streamy.configuration.avro_schema_registry_url}/).to_rack(FakeConfluentSchemaRegistryServer)
stub_request(:any, /^#{Streamy.configuration.avro_schema_registry_url}/).to_rack(AuthorizedFakeConfluentSchemaRegistryServer)
AuthorizedFakeConfluentSchemaRegistryServer.clear
end

class TestEvent < AvroEvent
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
require "avro_turf/test/fake_confluent_schema_registry_server"

class AuthorizedFakeConfluentSchemaRegistryServer < FakeConfluentSchemaRegistryServer
set :host_authorization, permitted_hosts: ['example.org', 'registry.example.com']
end

0 comments on commit 80ba4c0

Please sign in to comment.