# Summary

Class: | WireMock.Util.UrlUtils
Assembly: | WireMock.Net
File(s): | C:\Users\azureuser\Documents\Github\WireMock.Net\src\WireMock.Net\Util\UrlUtils.cs
Covered lines: | 15
Uncovered lines: | 0
Coverable lines: | 15
Total lines: | 38
Line coverage: | 100%
Branch coverage: | 100%

# Metrics

Method | Cyclomatic complexity | NPath complexity | Sequence coverage | Branch coverage
--- | --- | --- | --- | ---
Parse(...) | 0 | 0 | 1 | 1
RemoveFirst(...) | 0 | 0 | 1 | 1

# File(s)

## C:\Users\azureuser\Documents\Github\WireMock.Net\src\WireMock.Net\Util\UrlUtils.cs

| # | Line |  | Line coverage
--- | --- | --- | --- | ---
|  | `1` |  | `using System;`
|  | `2` |  | `using JetBrains.Annotations;`
|  | `3` |  | `using WireMock.Models;`
|  | `4` |  | `#if !USE_ASPNETCORE`
|  | `5` |  | `using Microsoft.Owin;`
|  | `6` |  | `#else`
|  | `7` |  | `using Microsoft.AspNetCore.Http;`
|  | `8` |  | `#endif`
|  | `9` |  | ``
|  | `10` |  | `namespace WireMock.Util`
|  | `11` |  | `{`
|  | `12` |  | `internal static class UrlUtils`
|  | `13` |  | `{`
|  | `14` |  | `public static UrlDetails Parse([NotNull] Uri uri, PathString pathBase)`
| 70 | `15` |  | `{`
| 70 | `16` |  | `if (!pathBase.HasValue)`
| 66 | `17` |  | `{`
| 66 | `18` |  | `return new UrlDetails(uri, uri);`
|  | `19` |  | `}`
|  | `20` |  | ``
| 4 | `21` |  | `var builder = new UriBuilder(uri);`
| 4 | `22` |  | `builder.Path = RemoveFirst(builder.Path, pathBase.Value);`
|  | `23` |  | ``
| 4 | `24` |  | `return new UrlDetails(uri, builder.Uri);`
| 70 | `25` |  | `}`
|  | `26` |  | ``
|  | `27` |  | `private static string RemoveFirst(string text, string search)`
| 4 | `28` |  | `{`
| 4 | `29` |  | `int pos = text.IndexOf(search);`
| 4 | `30` |  | `if (pos < 0)`
| 1 | `31` |  | `{`
| 1 | `32` |  | `return text;`
|  | `33` |  | `}`
|  | `34` |  | ``
| 3 | `35` |  | `return text.Substring(0, pos) + text.Substring(pos + search.Length);`
| 4 | `36` |  | `}`
|  | `37` |  | `}`
|  | `38` |  | `}`

# Methods/Properties

Parse(System.Uri,Microsoft.AspNetCore.Http.PathString)
RemoveFirst(System.String,System.String)