Skip to content

Commit 07c00a9

Browse files
Management API configuration does not allow HTTPS URLs (#1587)
* Bump RabbitMQ.Client from 7.1.1 to 7.1.2 in /src Bumps [RabbitMQ.Client](https://github.com/rabbitmq/rabbitmq-dotnet-client) from 7.1.1 to 7.1.2. - [Release notes](https://github.com/rabbitmq/rabbitmq-dotnet-client/releases) - [Changelog](https://github.com/rabbitmq/rabbitmq-dotnet-client/blob/main/CHANGELOG.md) - [Commits](rabbitmq/rabbitmq-dotnet-client@v7.1.1...v7.1.2) --- updated-dependencies: - dependency-name: RabbitMQ.Client dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Fix condition to allow https management API connections * Add failing test * Fix scheme checking condition --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
1 parent 57888aa commit 07c00a9

File tree

4 files changed

+21
-5
lines changed

4 files changed

+21
-5
lines changed

src/NServiceBus.Transport.RabbitMQ.CommandLine/NServiceBus.Transport.RabbitMQ.CommandLine.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
44
<TargetFramework>net8.0</TargetFramework>
@@ -18,7 +18,7 @@
1818

1919
<ItemGroup>
2020
<PackageReference Include="NServiceBus" Version="9.2.6" />
21-
<PackageReference Include="RabbitMQ.Client" Version="7.1.1" />
21+
<PackageReference Include="RabbitMQ.Client" Version="7.1.2" />
2222
<PackageReference Include="System.CommandLine" Version="2.0.0-beta4.22272.1" />
2323
</ItemGroup>
2424

src/NServiceBus.Transport.RabbitMQ.Tests/ManagementClientTests.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,22 @@ class ManagementClientTests
1818
static readonly ConnectionConfiguration connectionConfiguration = ConnectionConfiguration.Create(connectionString);
1919
static readonly ConnectionFactory connectionFactory = new(typeof(ManagementClientTests).FullName, connectionConfiguration, null, false, false, TimeSpan.FromSeconds(60), TimeSpan.FromSeconds(10), []);
2020

21+
[Test]
22+
public void Should_Pass_With_http_Scheme()
23+
{
24+
var managementApiConfiguration = new ManagementApiConfiguration("http://localhost:15672");
25+
26+
Assert.DoesNotThrow(() => new ManagementClient(connectionConfiguration, managementApiConfiguration));
27+
}
28+
29+
[Test]
30+
public void Should_Pass_With_https_Scheme()
31+
{
32+
var managementApiConfiguration = new ManagementApiConfiguration("https://localhost:15671");
33+
34+
Assert.DoesNotThrow(() => new ManagementClient(connectionConfiguration, managementApiConfiguration));
35+
}
36+
2137
[Test]
2238
public void Should_Throw_With_Invalid_Scheme()
2339
{

src/NServiceBus.Transport.RabbitMQ/Administration/ManagementApi/ManagementClient.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public ManagementClient(ConnectionConfiguration connectionConfiguration, Managem
3434
Password = managementApiConfiguration.Password ?? connectionConfiguration.Password
3535
};
3636

37-
if (uriBuilder.Scheme is not "http" or "https")
37+
if (uriBuilder.Scheme is not ("http" or "https"))
3838
{
3939
throw new NotSupportedException($"URL scheme '{uriBuilder.Scheme}' is not supported for the RabbitMQ management API URL. Valid schemes are 'http' and 'https'.");
4040
}

src/NServiceBus.Transport.RabbitMQ/NServiceBus.Transport.RabbitMQ.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
44
<TargetFramework>net8.0</TargetFramework>
@@ -10,7 +10,7 @@
1010
<ItemGroup>
1111
<PackageReference Include="BitFaster.Caching" Version="2.5.3" />
1212
<PackageReference Include="NServiceBus" Version="9.2.6" />
13-
<PackageReference Include="RabbitMQ.Client" Version="7.1.1" />
13+
<PackageReference Include="RabbitMQ.Client" Version="7.1.2" />
1414
</ItemGroup>
1515

1616
<ItemGroup>

0 commit comments

Comments
 (0)