Skip to content

Commit

Permalink
Allow more valid URIs in assertRabbitMqUri (#874)
Browse files Browse the repository at this point in the history
* Allow `amqps://` protocol in `assertRabbitMqUri`

* Allow trailing slash in `assertRabbitMqUri`

* Add more valid URIs to tests
  • Loading branch information
FloEdelmann authored Nov 7, 2024
1 parent aa7ef03 commit 7f8404a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/rabbitmq/src/amqp/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export function matchesRoutingKey(
}

const rabbitMQRegex =
/^amqp:\/\/(([^:]+):([^@]+)@)?([^:/]+)(:[0-9]+)?(\/[^\/]+)?$/;
/^amqps?:\/\/(([^:]+):([^@]+)@)?([^:/]+)(:[0-9]+)?(\/[^\/]*)?$/;

/**
* Validates a rabbitmq uri
Expand Down
3 changes: 3 additions & 0 deletions packages/rabbitmq/src/tests/rabbitmq.utils.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ describe(matchesRoutingKey.name, () => {
assertRabbitMqUri([
'amqp://rabbitmq:rabbitmq@localhost:4444',
'amqp://rabbitmq:rabbitmq@localhost:1234',
'amqps://rabbitmq:rabbitmq@localhost:2345',
'amqp://rabbitmq:rabbitmq@localhost:3456/',
'amqps://rabbitmq:rabbitmq@localhost:4567/',
]),
).not.toThrowError();
});
Expand Down

0 comments on commit 7f8404a

Please sign in to comment.