mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-04-28 03:07:01 +02:00
feat: add WithBody(req => dostuff) style callback (#102)
This commit is contained in:
committed by
Stef Heyenrath
parent
2b8a58c68c
commit
3f2c139f90
@@ -167,6 +167,13 @@ namespace WireMock.ResponseBuilders
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IBodyResponseBuilder.WithBody(Func{RequestMessage, string}, string, Encoding)"/>
|
||||
public IResponseBuilder WithBody(Func<RequestMessage, string> bodyFactory, string destination = BodyDestinationFormat.SameAsSource,
|
||||
Encoding encoding = null)
|
||||
{
|
||||
return WithCallback(req => new ResponseMessage {Body = bodyFactory(req)});
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IBodyResponseBuilder.WithBody(byte[], string, Encoding)"/>
|
||||
public IResponseBuilder WithBody(byte[] body, string destination, Encoding encoding = null)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user