summaryrefslogtreecommitdiff
path: root/src/SMAPI.Web/Framework/Extensions.cs
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2022-05-01 18:16:09 -0400
committerJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2022-05-01 18:16:09 -0400
commitc8ad50dad1d706a1901798f9396f6becfea36c0e (patch)
tree28bd818a5db39ec5ece1bd141a28de955950463b /src/SMAPI.Web/Framework/Extensions.cs
parent451b70953ff4c0b1b27ae0de203ad99379b45b2a (diff)
parentf78093bdb58d477b400cde3f19b70ffd6ddf833d (diff)
downloadSMAPI-c8ad50dad1d706a1901798f9396f6becfea36c0e.tar.gz
SMAPI-c8ad50dad1d706a1901798f9396f6becfea36c0e.tar.bz2
SMAPI-c8ad50dad1d706a1901798f9396f6becfea36c0e.zip
Merge branch 'develop' into stable
Diffstat (limited to 'src/SMAPI.Web/Framework/Extensions.cs')
-rw-r--r--src/SMAPI.Web/Framework/Extensions.cs10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/SMAPI.Web/Framework/Extensions.cs b/src/SMAPI.Web/Framework/Extensions.cs
index 5305b142..62a23155 100644
--- a/src/SMAPI.Web/Framework/Extensions.cs
+++ b/src/SMAPI.Web/Framework/Extensions.cs
@@ -26,10 +26,10 @@ namespace StardewModdingAPI.Web.Framework
/// <param name="values">An object that contains route values.</param>
/// <param name="absoluteUrl">Get an absolute URL instead of a server-relative path/</param>
/// <returns>The generated URL.</returns>
- public static string PlainAction(this IUrlHelper helper, [AspMvcAction] string action, [AspMvcController] string controller, object values = null, bool absoluteUrl = false)
+ public static string? PlainAction(this IUrlHelper helper, [AspMvcAction] string action, [AspMvcController] string controller, object? values = null, bool absoluteUrl = false)
{
// get route values
- RouteValueDictionary valuesDict = new RouteValueDictionary(values);
+ RouteValueDictionary valuesDict = new(values);
foreach (var value in helper.ActionContext.RouteData.Values)
{
if (!valuesDict.ContainsKey(value.Key))
@@ -37,7 +37,7 @@ namespace StardewModdingAPI.Web.Framework
}
// get relative URL
- string url = helper.Action(action, controller, valuesDict);
+ string? url = helper.Action(action, controller, valuesDict);
if (url == null && action.EndsWith("Async"))
url = helper.Action(action[..^"Async".Length], controller, valuesDict);
@@ -45,7 +45,7 @@ namespace StardewModdingAPI.Web.Framework
if (absoluteUrl)
{
HttpRequest request = helper.ActionContext.HttpContext.Request;
- Uri baseUri = new Uri($"{request.Scheme}://{request.Host}");
+ Uri baseUri = new($"{request.Scheme}://{request.Host}");
url = new Uri(baseUri, url).ToString();
}
@@ -57,7 +57,7 @@ namespace StardewModdingAPI.Web.Framework
/// <param name="value">The value to serialize.</param>
/// <returns>The serialized JSON.</returns>
/// <remarks>This bypasses unnecessary validation (e.g. not allowing null values) in <see cref="IJsonHelper.Serialize"/>.</remarks>
- public static IHtmlContent ForJson(this RazorPageBase page, object value)
+ public static IHtmlContent ForJson(this RazorPageBase page, object? value)
{
string json = JsonConvert.SerializeObject(value);
return new HtmlString(json);