mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-03-28 20:32:13 +01:00
Add WebSockets (#1423)
* 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
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user