Skip to content

Commit

Permalink
refactor(ffi): Migrate mock server to use transport instead of addres…
Browse files Browse the repository at this point in the history
…s string
  • Loading branch information
adamrodger committed Feb 15, 2024
1 parent d01e0b1 commit 793ee46
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
3 changes: 1 addition & 2 deletions src/PactNet/Drivers/HttpPactDriver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ public IHttpInteractionDriver NewHttpInteraction(string description)
/// <exception cref="InvalidOperationException">Failed to start mock server</exception>
public IMockServerDriver CreateMockServer(string host, int? port, bool tls)
{
string addrStr = $"{host}:{port.GetValueOrDefault(0)}";
int result = NativeInterop.CreateMockServerForPact(this.pact, addrStr, tls);
int result = NativeInterop.CreateMockServerForTransport(this.pact, host, (ushort)port.GetValueOrDefault(0), "http", null);

if (result > 0)
{
Expand Down
4 changes: 2 additions & 2 deletions src/PactNet/Interop/NativeInterop.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ internal static class NativeInterop

#region Http Interop Support

[DllImport(DllName, EntryPoint = "pactffi_create_mock_server_for_pact")]
public static extern int CreateMockServerForPact(PactHandle pact, string addrStr, bool tls);
[DllImport(DllName, EntryPoint = "pactffi_create_mock_server_for_transport")]
public static extern int CreateMockServerForTransport(PactHandle pact, string addrStr, ushort port, string transport, string transportConfig);

[DllImport(DllName, EntryPoint = "pactffi_mock_server_mismatches")]
public static extern IntPtr MockServerMismatches(int mockServerPort);
Expand Down

0 comments on commit 793ee46

Please sign in to comment.