#603 trim final url
This commit is contained in:
parent
05d0a311c3
commit
e24ff982e6
@ -604,5 +604,11 @@ namespace Flurl.Test.UrlBuilder
|
||||
url.AppendPathSegment("///");
|
||||
Assert.AreEqual("https://www.site.com/a/b/c///", url.ToString());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void url_trims_leading_and_trailing_whitespace() {
|
||||
var url = new Url(" https://www.site.com \t");
|
||||
Assert.AreEqual("https://www.site.com", url.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -140,10 +140,9 @@ namespace Flurl
|
||||
/// <summary>
|
||||
/// Constructs a Url object from a string.
|
||||
/// </summary>
|
||||
/// <param name="baseUrl">The URL to use as a starting point (required)</param>
|
||||
/// <exception cref="ArgumentNullException"><paramref name="baseUrl"/> is <see langword="null" />.</exception>
|
||||
/// <param name="baseUrl">The URL to use as a starting point.</param>
|
||||
public Url(string baseUrl = null) {
|
||||
_originalString = baseUrl;
|
||||
_originalString = baseUrl?.Trim();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -508,7 +507,7 @@ namespace Flurl
|
||||
QueryParams.Any() ? "?" : "",
|
||||
QueryParams.ToString(encodeSpaceAsPlus),
|
||||
Fragment?.Length > 0 ? "#" : "",
|
||||
Fragment);
|
||||
Fragment).Trim();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
Loading…
x
Reference in New Issue
Block a user