mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-02-22 08:47:51 +01:00
* Add WebSockets * Add tests * fix * more tests * Add tests * ... * remove IOwin * - * tests * fluent * ok * match * . * byte[] * x * func * func * byte * trans * ... * frameworks......... * jmes * xxx * sc
48 lines
1.2 KiB
C#
48 lines
1.2 KiB
C#
// Copyright © WireMock.Net
|
|
|
|
using WireMock.Settings;
|
|
using WireMock.WebSockets;
|
|
|
|
namespace WireMock.ResponseBuilders;
|
|
|
|
public partial class Response
|
|
{
|
|
/// <summary>
|
|
/// Internal property to store WebSocket builder configuration
|
|
/// </summary>
|
|
internal WebSocketBuilder? WebSocketBuilder { get; set; }
|
|
|
|
/// <summary>
|
|
/// Configure WebSocket response behavior
|
|
/// </summary>
|
|
public IResponseBuilder WithWebSocket(Action<IWebSocketBuilder> configure)
|
|
{
|
|
var builder = new WebSocketBuilder(this);
|
|
configure(builder);
|
|
|
|
WebSocketBuilder = builder;
|
|
|
|
return this;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Proxy WebSocket to another server
|
|
/// </summary>
|
|
public IResponseBuilder WithWebSocketProxy(string targetUrl)
|
|
{
|
|
return WithWebSocketProxy(new ProxyAndRecordSettings { Url = targetUrl });
|
|
}
|
|
|
|
/// <summary>
|
|
/// Proxy WebSocket to another server with settings
|
|
/// </summary>
|
|
public IResponseBuilder WithWebSocketProxy(ProxyAndRecordSettings settings)
|
|
{
|
|
var builder = new WebSocketBuilder(this);
|
|
builder.WithProxy(settings);
|
|
|
|
WebSocketBuilder = builder;
|
|
|
|
return this;
|
|
}
|
|
} |