Create WireMock.Net.MimePart project (#1300)

* Create WireMock.Net.MimePart project

* .

* REFACTOR

* ILRepack

* --

* ...

* x

* x

* .

* fix

* public class MimePartMatcher

* shared

* min

* .

* <!--<DelaySign>true</DelaySign>-->

* Update README.md

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
Stef Heyenrath
2025-05-24 12:17:42 +02:00
committed by GitHub
parent c15206ecd8
commit 96eca4262a
306 changed files with 9746 additions and 9285 deletions

View File

@@ -0,0 +1,26 @@
// Copyright © WireMock.Net
using System.Text.RegularExpressions;
using Stef.Validation;
using WireMock.Constants;
namespace WireMock.Util;
/// <summary>
/// https://en.wikipedia.org/wiki/HTTP
/// </summary>
internal static class HttpVersionParser
{
private static readonly Regex HttpVersionRegex = new(@"HTTP/(\d+(\.\d+)?(?!\.))", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant | RegexOptions.Compiled, RegexConstants.DefaultTimeout);
/// <summary>
/// Try to extract the version (as a string) from the protocol.
/// </summary>
/// <param name="protocol">The protocol, something like "HTTP/1.1" or "HTTP/2".</param>
/// <returns>The version ("1.1" or "2") if found and valid, else empty string.</returns>
internal static string Parse(string protocol)
{
var match = HttpVersionRegex.Match(Guard.NotNull(protocol));
return match.Success ? match.Groups[1].Value : string.Empty;
}
}