Skip to content

Commit ed7853f

Browse files
authored
Cleanup code (#27)
1 parent 00c20cb commit ed7853f

File tree

4 files changed

+18
-18
lines changed

4 files changed

+18
-18
lines changed

src/Azure.WebJobs.Extensions.HttpApi/Core/LocalStaticAppResult.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
namespace Azure.WebJobs.Extensions.HttpApi.Core
77
{
8-
internal class LocalStaticAppResult : IActionResult
8+
public class LocalStaticAppResult : IActionResult
99
{
1010
public string DefaultFile { get; set; }
1111

src/Azure.WebJobs.Extensions.HttpApi/Core/ProxyResult.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
namespace Azure.WebJobs.Extensions.HttpApi.Core
88
{
9-
internal class ProxyResult : IActionResult
9+
public class ProxyResult : IActionResult
1010
{
1111
public ProxyResult(string backendUri)
1212
{

src/Azure.WebJobs.Extensions.HttpApi/Core/RemoteStaticAppResult.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
namespace Azure.WebJobs.Extensions.HttpApi.Core
66
{
7-
internal class RemoteStaticAppResult : ProxyResult
7+
public class RemoteStaticAppResult : ProxyResult
88
{
99
public RemoteStaticAppResult(string backendUri)
1010
: base(backendUri)

src/Azure.WebJobs.Extensions.HttpApi/HttpFunctionBase.cs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -129,26 +129,26 @@ protected ObjectResult Problem(string detail = null, string instance = null, int
129129
{
130130
var problemDetails = ProblemDetailsFactory.CreateProblemDetails(HttpContext, statusCode ?? 500, title, type, detail, instance);
131131

132-
return new ObjectResult(problemDetails) { StatusCode = problemDetails.Status };
132+
return new(problemDetails) { StatusCode = problemDetails.Status };
133133
}
134134

135-
protected ActionResult ValidationProblem(ValidationProblemDetails descriptor)
135+
protected BadRequestObjectResult ValidationProblem(ValidationProblemDetails descriptor)
136136
{
137137
if (descriptor is null)
138138
{
139139
throw new ArgumentNullException(nameof(descriptor));
140140
}
141141

142-
return new BadRequestObjectResult(descriptor);
142+
return new(descriptor);
143143
}
144144

145-
protected ActionResult ValidationProblem(ModelStateDictionary modelState) => ValidationProblem(modelStateDictionary: modelState);
145+
protected ObjectResult ValidationProblem(ModelStateDictionary modelState) => ValidationProblem(modelStateDictionary: modelState);
146146

147147
protected ObjectResult ValidationProblem(string detail = null, string instance = null, int? statusCode = null, string title = null, string type = null, ModelStateDictionary modelStateDictionary = null)
148148
{
149149
var validationProblem = ProblemDetailsFactory.CreateValidationProblemDetails(HttpContext, modelStateDictionary ?? ModelState, statusCode, title, type, detail, instance);
150150

151-
return new ObjectResult(validationProblem) { StatusCode = validationProblem.Status };
151+
return new(validationProblem) { StatusCode = validationProblem.Status };
152152
}
153153

154154
protected CreatedResult Created(string uri, object value)
@@ -158,7 +158,7 @@ protected CreatedResult Created(string uri, object value)
158158
throw new ArgumentNullException(nameof(uri));
159159
}
160160

161-
return new CreatedResult(uri, value);
161+
return new(uri, value);
162162
}
163163

164164
protected CreatedResult Created(Uri uri, object value)
@@ -168,7 +168,7 @@ protected CreatedResult Created(Uri uri, object value)
168168
throw new ArgumentNullException(nameof(uri));
169169
}
170170

171-
return new CreatedResult(uri, value);
171+
return new(uri, value);
172172
}
173173

174174
protected CreatedResult CreatedAtFunction(string functionName) => CreatedAtFunction(functionName, null, null);
@@ -187,7 +187,7 @@ protected AcceptedResult Accepted(Uri uri)
187187
throw new ArgumentNullException(nameof(uri));
188188
}
189189

190-
return new AcceptedResult(uri, null);
190+
return new(uri, null);
191191
}
192192

193193
protected AcceptedResult Accepted(string uri) => new(uri, null);
@@ -199,7 +199,7 @@ protected AcceptedResult Accepted(Uri uri, object value)
199199
throw new ArgumentNullException(nameof(uri));
200200
}
201201

202-
return new AcceptedResult(uri, value);
202+
return new(uri, value);
203203
}
204204

205205
protected AcceptedResult Accepted(string uri, object value) => new(uri, value);
@@ -213,29 +213,29 @@ protected AcceptedResult AcceptedAtFunction(string functionName, object routeVal
213213
protected StatusCodeResult Forbid() => StatusCode(StatusCodes.Status403Forbidden);
214214
protected ObjectResult Forbid(object value) => StatusCode(StatusCodes.Status403Forbidden, value);
215215

216-
protected IActionResult Proxy(string backendUri, Action<HttpRequestMessage> beforeSend = null, Action<HttpResponseMessage> afterSend = null)
216+
protected ProxyResult Proxy(string backendUri, Action<HttpRequestMessage> beforeSend = null, Action<HttpResponseMessage> afterSend = null)
217217
{
218218
if (backendUri is null)
219219
{
220220
throw new ArgumentNullException(nameof(backendUri));
221221
}
222222

223-
return new ProxyResult(backendUri) { BeforeSend = beforeSend, AfterSend = afterSend };
223+
return new(backendUri) { BeforeSend = beforeSend, AfterSend = afterSend };
224224
}
225225

226-
protected IActionResult RemoteStaticApp(string backendUri, string fallbackExclude = null)
226+
protected RemoteStaticAppResult RemoteStaticApp(string backendUri, string fallbackExclude = null)
227227
{
228228
if (backendUri is null)
229229
{
230230
throw new ArgumentNullException(nameof(backendUri));
231231
}
232232

233-
return new RemoteStaticAppResult(backendUri) { FallbackExclude = fallbackExclude };
233+
return new(backendUri) { FallbackExclude = fallbackExclude };
234234
}
235235

236-
protected IActionResult LocalStaticApp(string defaultFile = "index.html", string fallbackPath = "404.html", string fallbackExclude = null)
236+
protected LocalStaticAppResult LocalStaticApp(string defaultFile = "index.html", string fallbackPath = "404.html", string fallbackExclude = null)
237237
{
238-
return new LocalStaticAppResult { DefaultFile = defaultFile, FallbackPath = fallbackPath, FallbackExclude = fallbackExclude };
238+
return new() { DefaultFile = defaultFile, FallbackPath = fallbackPath, FallbackExclude = fallbackExclude };
239239
}
240240

241241
#endregion

0 commit comments

Comments
 (0)