mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-03-30 13:51:48 +02:00
...
This commit is contained in:
@@ -1,12 +1,6 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
//#if !USE_ASPNETCORE
|
||||
//using IRequest = Microsoft.Owin.IOwinRequest;
|
||||
//#else
|
||||
//using IRequest = Microsoft.AspNetCore.Http.HttpRequest;
|
||||
//#endif
|
||||
|
||||
namespace WireMock.Owin.Mappers;
|
||||
|
||||
@@ -18,8 +12,8 @@ internal interface IOwinRequestMapper
|
||||
/// <summary>
|
||||
/// MapAsync IRequest to RequestMessage
|
||||
/// </summary>
|
||||
/// <param name="request">The HttpRequest</param>
|
||||
/// <param name="context">The HttpContext</param>
|
||||
/// <param name="options">The WireMockMiddlewareOptions</param>
|
||||
/// <returns>RequestMessage</returns>
|
||||
Task<RequestMessage> MapAsync(HttpRequest request, IWireMockMiddlewareOptions options);
|
||||
Task<RequestMessage> MapAsync(HttpContext context, IWireMockMiddlewareOptions options);
|
||||
}
|
||||
@@ -1,9 +1,5 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Http.Extensions;
|
||||
using WireMock.Http;
|
||||
@@ -18,8 +14,9 @@ namespace WireMock.Owin.Mappers;
|
||||
internal class OwinRequestMapper : IOwinRequestMapper
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public async Task<RequestMessage> MapAsync(HttpRequest request, IWireMockMiddlewareOptions options)
|
||||
public async Task<RequestMessage> MapAsync(HttpContext context, IWireMockMiddlewareOptions options)
|
||||
{
|
||||
var request = context.Request;
|
||||
var (urlDetails, clientIP) = ParseRequest(request);
|
||||
|
||||
var method = request.Method;
|
||||
|
||||
@@ -68,7 +68,7 @@ internal class WireMockMiddleware
|
||||
// Store options in HttpContext for providers to access (e.g., WebSocketResponseProvider)
|
||||
ctx.Items[nameof(WireMockMiddlewareOptions)] = _options;
|
||||
|
||||
var request = await _requestMapper.MapAsync(ctx.Request, _options).ConfigureAwait(false);
|
||||
var request = await _requestMapper.MapAsync(ctx, _options).ConfigureAwait(false);
|
||||
|
||||
var logRequest = false;
|
||||
IResponseMessage? response = null;
|
||||
|
||||
Reference in New Issue
Block a user