mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-03-18 07:13:46 +01:00
30 lines
1011 B
C#
30 lines
1011 B
C#
#if USE_ASPNETCORE && NETSTANDARD1_3
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using Microsoft.AspNetCore.Hosting;
|
|
using Microsoft.AspNetCore.Server.Kestrel;
|
|
using WireMock.HttpsCertificate;
|
|
|
|
namespace WireMock.Owin
|
|
{
|
|
internal partial class AspNetCoreSelfHost
|
|
{
|
|
private static void SetKestrelOptionsLimits(KestrelServerOptions options)
|
|
{
|
|
options.Limits.MaxRequestBufferSize = null;
|
|
options.Limits.MaxRequestHeaderCount = 100;
|
|
options.Limits.MaxResponseBufferSize = null;
|
|
}
|
|
|
|
private static void SetHttpsAndUrls(KestrelServerOptions options, ICollection<(string Url, int Port)> urlDetails)
|
|
{
|
|
var urls = urlDetails.Select(u => u.Url);
|
|
if (urls.Any(u => u.StartsWith("https://", StringComparison.OrdinalIgnoreCase)))
|
|
{
|
|
options.UseHttps(PublicCertificateHelper.GetX509Certificate2());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
#endif |