mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-03-28 11:51:48 +01:00
Cleanup some files
This commit is contained in:
@@ -1,65 +0,0 @@
|
||||
//using System;
|
||||
//using System.Collections.Generic;
|
||||
//using System.IO;
|
||||
//using System.Linq;
|
||||
//using System.Net;
|
||||
//using System.Text;
|
||||
//#if NET45
|
||||
|
||||
//#else
|
||||
//using System.Net.Http;
|
||||
//#endif
|
||||
|
||||
//namespace WireMock.Http
|
||||
//{
|
||||
// /// <summary>
|
||||
// /// The http listener request mapper.
|
||||
// /// </summary>
|
||||
// public class HttpListenerRequestMapperOld
|
||||
// {
|
||||
// /// <summary>
|
||||
// /// The map.
|
||||
// /// </summary>
|
||||
// /// <param name="listenerRequest">The listener request.</param>
|
||||
// /// <returns>The <see cref="RequestMessage"/>.</returns>
|
||||
// public RequestMessage MapAsync(HttpListenerRequest listenerRequest)
|
||||
// {
|
||||
// Uri url = listenerRequest.Url;
|
||||
// string verb = listenerRequest.HttpMethod;
|
||||
// byte[] body = GetRequestBody(listenerRequest);
|
||||
// Encoding bodyEncoding = body != null ? listenerRequest.ContentEncoding : null;
|
||||
// string bodyAsString = bodyEncoding?.GetString(body);
|
||||
// var listenerHeaders = listenerRequest.Headers;
|
||||
// var headers = listenerHeaders.AllKeys.ToDictionary(k => k, k => listenerHeaders[k]);
|
||||
// var cookies = new Dictionary<string, string>();
|
||||
|
||||
// foreach (Cookie cookie in listenerRequest.Cookies)
|
||||
// cookies.Add(cookie.Name, cookie.Value);
|
||||
|
||||
// return new RequestMessage(url, verb, body, bodyAsString, bodyEncoding, headers, cookies) { DateTime = DateTime.Now };
|
||||
// }
|
||||
|
||||
// /// <summary>
|
||||
// /// The get request body.
|
||||
// /// </summary>
|
||||
// /// <param name="request">The request.</param>
|
||||
// /// <returns>The <see cref="string"/>.</returns>
|
||||
// private byte[] GetRequestBody(HttpListenerRequest request)
|
||||
// {
|
||||
// if (!request.HasEntityBody)
|
||||
// {
|
||||
// return null;
|
||||
// }
|
||||
|
||||
// using (var bodyStream = request.InputStream)
|
||||
// {
|
||||
// using (var memoryStream = new MemoryStream())
|
||||
// {
|
||||
// bodyStream.CopyTo(memoryStream);
|
||||
|
||||
// return memoryStream.ToArray();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
@@ -1,44 +0,0 @@
|
||||
//using System.Linq;
|
||||
//using System.Net;
|
||||
//using System.Text;
|
||||
//#if NET45
|
||||
|
||||
//#else
|
||||
//using System.Net.Http;
|
||||
//#endif
|
||||
|
||||
//namespace WireMock.Http
|
||||
//{
|
||||
// /// <summary>
|
||||
// /// The http listener response mapper.
|
||||
// /// </summary>
|
||||
// public class HttpListenerResponseMapperOld
|
||||
// {
|
||||
// private readonly Encoding _utf8NoBom = new UTF8Encoding(false);
|
||||
|
||||
// /// <summary>
|
||||
// /// The map.
|
||||
// /// </summary>
|
||||
// /// <param name="responseMessage">
|
||||
// /// The response.
|
||||
// /// </param>
|
||||
// /// <param name="listenerResponse">The listenerResponse.</param>
|
||||
// public void MapAsync(ResponseMessage responseMessage, HttpListenerResponse listenerResponse)
|
||||
// {
|
||||
// listenerResponse.StatusCode = responseMessage.StatusCode;
|
||||
|
||||
// responseMessage.Headers.ToList().ForEach(pair => listenerResponse.AddHeader(pair.Key, pair.Value));
|
||||
|
||||
// if (responseMessage.Body == null)
|
||||
// return;
|
||||
|
||||
// var encoding = responseMessage.BodyEncoding ?? _utf8NoBom;
|
||||
// byte[] buffer = encoding.GetBytes(responseMessage.Body);
|
||||
|
||||
// listenerResponse.ContentEncoding = encoding;
|
||||
// listenerResponse.ContentLength64 = buffer.Length;
|
||||
// listenerResponse.OutputStream.Write(buffer, 0, buffer.Length);
|
||||
// listenerResponse.OutputStream.Flush();
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
@@ -1,117 +0,0 @@
|
||||
//using System;
|
||||
//using System.Collections.Generic;
|
||||
//#if NET45
|
||||
//using System.Net;
|
||||
//#else
|
||||
//using System.Net.Http;
|
||||
//#endif
|
||||
//using System.Threading;
|
||||
//using System.Threading.Tasks;
|
||||
//using JetBrains.Annotations;
|
||||
//using WireMock.Validation;
|
||||
|
||||
//namespace WireMock.Http
|
||||
//{
|
||||
// /// <summary>
|
||||
// /// The tiny http server.
|
||||
// /// </summary>
|
||||
// public class TinyHttpServerOld
|
||||
// {
|
||||
// private readonly Action<HttpListenerContext, CancellationToken> _httpHandler;
|
||||
|
||||
// private readonly HttpListener _listener;
|
||||
|
||||
// private readonly CancellationTokenSource _cts;
|
||||
|
||||
// /// <summary>
|
||||
// /// Gets a value indicating whether this server is started.
|
||||
// /// </summary>
|
||||
// /// <value>
|
||||
// /// <c>true</c> if this server is started; otherwise, <c>false</c>.
|
||||
// /// </value>
|
||||
// public bool IsStarted { get; private set; }
|
||||
|
||||
// /// <summary>
|
||||
// /// Gets the url.
|
||||
// /// </summary>
|
||||
// /// <value>
|
||||
// /// The urls.
|
||||
// /// </value>
|
||||
// [PublicAPI]
|
||||
// public List<Uri> Urls { get; } = new List<Uri>();
|
||||
|
||||
// /// <summary>
|
||||
// /// Gets the ports.
|
||||
// /// </summary>
|
||||
// /// <value>
|
||||
// /// The ports.
|
||||
// /// </value>
|
||||
// [PublicAPI]
|
||||
// public List<int> Ports { get; } = new List<int>();
|
||||
|
||||
// /// <summary>
|
||||
// /// Initializes a new instance of the <see cref="TinyHttpServer"/> class.
|
||||
// /// </summary>
|
||||
// /// <param name="uriPrefixes">The uriPrefixes.</param>
|
||||
// /// <param name="httpHandler">The http handler.</param>
|
||||
// public TinyHttpServerOld([NotNull] Action<HttpListenerContext, CancellationToken> httpHandler, [NotNull] params string[] uriPrefixes)
|
||||
// {
|
||||
// Check.NotNull(httpHandler, nameof(httpHandler));
|
||||
// Check.NotEmpty(uriPrefixes, nameof(uriPrefixes));
|
||||
|
||||
// _cts = new CancellationTokenSource();
|
||||
|
||||
// _httpHandler = httpHandler;
|
||||
|
||||
// // Create a listener.
|
||||
// _listener = new HttpListener();
|
||||
// foreach (string uriPrefix in uriPrefixes)
|
||||
// {
|
||||
// var uri = new Uri(uriPrefix);
|
||||
// Urls.Add(uri);
|
||||
// Ports.Add(uri.Port);
|
||||
|
||||
// _listener.Prefixes.Add(uriPrefix);
|
||||
// }
|
||||
// }
|
||||
|
||||
// /// <summary>
|
||||
// /// Start the server.
|
||||
// /// </summary>
|
||||
// [PublicAPI]
|
||||
// public void Start()
|
||||
// {
|
||||
// _listener.Start();
|
||||
|
||||
// IsStarted = true;
|
||||
|
||||
// Task.Run(
|
||||
// async () =>
|
||||
// {
|
||||
// //using (_listener)
|
||||
// {
|
||||
// while (!_cts.Token.IsCancellationRequested)
|
||||
// {
|
||||
// HttpListenerContext context = await _listener.GetContextAsync();
|
||||
// _httpHandler(context, _cts.Token);
|
||||
// }
|
||||
|
||||
// _listener.Stop();
|
||||
// IsStarted = false;
|
||||
// }
|
||||
// },
|
||||
// _cts.Token);
|
||||
// }
|
||||
|
||||
// /// <summary>
|
||||
// /// Stop the server.
|
||||
// /// </summary>
|
||||
// [PublicAPI]
|
||||
// public void Stop()
|
||||
// {
|
||||
// _listener?.Stop();
|
||||
|
||||
// _cts.Cancel();
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
Reference in New Issue
Block a user