mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-03-18 07:13:46 +01:00
* [265] Add file upload to allow mocking of file operations * [265] Fix failing test * Update code + add tests * LocalFileSystemHandlerTests * 1.0.13 * Fixed the file post to create the mapping folder if none exists to begin with, otherwise the file upload fails with 404 (can't find the folder to upload to). * fix tests * add more tests for LocalFileSystemHandler * Added the head method for files to check if a file exists without returning it as a body. * Add a test and fix the response message (head requires no body). * Fix newline * Fix newline. * Fix the number of mapping tests * Update tests and update client-interface-api * Cleanup "MappingConverter.cs"
45 lines
1.3 KiB
C#
45 lines
1.3 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using WireMock.Admin.Mappings;
|
|
using WireMock.Http;
|
|
using WireMock.Util;
|
|
|
|
namespace WireMock
|
|
{
|
|
internal static class ResponseMessageBuilder
|
|
{
|
|
private static string ContentTypeJson = "application/json";
|
|
private static readonly IDictionary<string, WireMockList<string>> ContentTypeJsonHeaders = new Dictionary<string, WireMockList<string>>
|
|
{
|
|
{ HttpKnownHeaderNames.ContentType, new WireMockList<string> { ContentTypeJson } }
|
|
};
|
|
|
|
internal static ResponseMessage Create(string message, int statusCode = 200, Guid? guid = null)
|
|
{
|
|
var response = new ResponseMessage
|
|
{
|
|
StatusCode = statusCode,
|
|
Headers = ContentTypeJsonHeaders
|
|
};
|
|
|
|
if (message != null)
|
|
{
|
|
response.BodyData = new BodyData
|
|
{
|
|
DetectedBodyType = BodyType.Json,
|
|
BodyAsJson = new StatusModel { Status = message, Guid = guid }
|
|
};
|
|
}
|
|
|
|
return response;
|
|
}
|
|
|
|
internal static ResponseMessage Create(int statusCode)
|
|
{
|
|
return new ResponseMessage
|
|
{
|
|
StatusCode = statusCode
|
|
};
|
|
}
|
|
}
|
|
} |