mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-02-22 00:37:50 +01:00
51 lines
1007 B
C#
51 lines
1007 B
C#
// Copyright © WireMock.Net
|
|
|
|
using System;
|
|
using Stef.Validation;
|
|
using WireMock.Models;
|
|
|
|
namespace WireMock.ResponseBuilders;
|
|
|
|
/// <summary>
|
|
/// Implementation of IWebSocketMessage
|
|
/// </summary>
|
|
public class WebSocketMessage : IWebSocketMessage
|
|
{
|
|
private string? _bodyAsString;
|
|
private byte[]? _bodyAsBytes;
|
|
|
|
/// <inheritdoc />
|
|
public int DelayMs { get; set; }
|
|
|
|
/// <inheritdoc />
|
|
public string? BodyAsString
|
|
{
|
|
get => _bodyAsString;
|
|
set
|
|
{
|
|
_bodyAsString = value;
|
|
_bodyAsBytes = null;
|
|
}
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
public byte[]? BodyAsBytes
|
|
{
|
|
get => _bodyAsBytes;
|
|
set
|
|
{
|
|
_bodyAsBytes = value;
|
|
_bodyAsString = null;
|
|
}
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
public bool IsText => _bodyAsBytes == null;
|
|
|
|
/// <inheritdoc />
|
|
public string Id { get; set; } = Guid.NewGuid().ToString();
|
|
|
|
/// <inheritdoc />
|
|
public string? CorrelationId { get; set; }
|
|
}
|