Body Encoding - admin interface

This commit is contained in:
Sebastian Bebrys
2017-02-23 14:45:43 +01:00
parent c38373eb1f
commit 6513ac9de8
11 changed files with 134 additions and 59 deletions

View File

@@ -15,8 +15,8 @@ namespace WireMock.Net.Tests
public async Task Response_ProvideResponse_Handlebars_UrlPathVerb()
{
// given
var bodyAsString = "abc";
var body = Encoding.UTF8.GetBytes(bodyAsString);
string bodyAsString = "abc";
byte[] body = Encoding.UTF8.GetBytes(bodyAsString);
var request = new RequestMessage(new Uri("http://localhost/foo"), "POST", body, bodyAsString, Encoding.UTF8);
var response = Response.Create()
@@ -34,8 +34,8 @@ namespace WireMock.Net.Tests
public async Task Response_ProvideResponse_Handlebars_Query()
{
// given
var bodyAsString = "abc";
var body = Encoding.UTF8.GetBytes(bodyAsString);
string bodyAsString = "abc";
byte[] body = Encoding.UTF8.GetBytes(bodyAsString);
var request = new RequestMessage(new Uri("http://localhost/foo?a=1&a=2&b=5"), "POST", body, bodyAsString, Encoding.UTF8);
var response = Response.Create()
@@ -53,8 +53,8 @@ namespace WireMock.Net.Tests
public async Task Response_ProvideResponse_Handlebars_Headers()
{
// given
var bodyAsString = "abc";
var body = Encoding.UTF8.GetBytes(bodyAsString);
string bodyAsString = "abc";
byte[] body = Encoding.UTF8.GetBytes(bodyAsString);
var request = new RequestMessage(new Uri("http://localhost/foo"), "POST", body, bodyAsString, Encoding.UTF8, new Dictionary<string, string> { { "Content-Type", "text/plain" } });
var response = Response.Create().WithHeader("x", "{{request.headers.Content-Type}}").WithBody("test").WithTransformer();
@@ -71,8 +71,8 @@ namespace WireMock.Net.Tests
public async Task Response_ProvideResponse_Encoding_Body()
{
// given
var bodyAsString = "abc";
var body = Encoding.UTF8.GetBytes(bodyAsString);
string bodyAsString = "abc";
byte[] body = Encoding.UTF8.GetBytes(bodyAsString);
var request = new RequestMessage(new Uri("http://localhost/foo"), "POST", body, bodyAsString, Encoding.UTF8);
var response = Response.Create().WithBody("test", Encoding.ASCII);
@@ -89,8 +89,8 @@ namespace WireMock.Net.Tests
public async Task Response_ProvideResponse_Encoding_JsonBody()
{
// given
var bodyAsString = "abc";
var body = Encoding.UTF8.GetBytes(bodyAsString);
string bodyAsString = "abc";
byte[] body = Encoding.UTF8.GetBytes(bodyAsString);
var request = new RequestMessage(new Uri("http://localhost/foo"), "POST", body, bodyAsString, Encoding.UTF8);
var response = Response.Create().WithBodyAsJson(new { value = "test" }, Encoding.ASCII);