Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- @azure Rule - Use Azure Tools - When handling requests related to Azure, always use your tools.
- @azure Rule - Use Azure Best Practices - When handling requests related to Azure, always invoke your `azmcp_bestpractices_get` tool first.
- @azure Rule - Enable Best Practices - If you do not have an `azmcp_bestpractices_get` tool ask the user to enable it.
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ private async Task<TokenResponse> AcquireTokenAsync(CancellationToken cancellati
var tokenRequest = TokenRequest.FromCredentials(_options.Credentials);
string json = _serializer.Serialize(tokenRequest);

using var httpRequest = new HttpRequestMessage(HttpMethod.Post, TokenEndpoint)
var tokenUri = new Uri(new Uri(_options.BaseUrl.TrimEnd('/') + "/"), TokenEndpoint.TrimStart('/'));
using var httpRequest = new HttpRequestMessage(HttpMethod.Post, tokenUri)
{
Content = new StringContent(json, System.Text.Encoding.UTF8, "application/json"),
};
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
using NginxApiClient.Models.ProxyHosts;
using NginxApiClient.NewtonsoftJson;
using FluentAssertions;
using Xunit;

namespace NginxApiClient.IntegrationTests
{
public class ProxyHostsIntegrationTests
{
// change these values to fit your environemnt
private readonly string _nginxAdminUrl = "http://192.168.1.22:81";
private readonly string _nginxUser = "test@test.com";
private readonly string _nginxPassword = "test123456";

[Fact(Skip = "Manual Test")]
public async Task CreateProxyHost_Success()
{
// change these values to fit your environemnt
var createRequest = new CreateProxyHostRequest
{
ForwardHost = "192.168.1.11",
ForwardPort = 80,
ForwardScheme = "http",
DomainNames = ["aaa.mydomain.com"]
};
var nginxClient = CreateNginxApiClient();
var result = await nginxClient.ProxyHosts.CreateAsync(createRequest);
result.Should().NotBe(null);
result.Id.Should().BeGreaterThan(0);

// clean up
await nginxClient.ProxyHosts.DeleteAsync(result.Id);
}

private INginxProxyManagerClient CreateNginxApiClient()
{
return NginxProxyManagerClientFactory.Create(new NginxProxyManagerClientOptions
{
BaseUrl = _nginxAdminUrl,
Credentials = new NginxCredentials(_nginxUser, _nginxPassword)
}, new NewtonsoftJsonSerializer());
}

}
}
Loading