Bumped package version to 1.1.6 and removed RouteListenerContext in favor of built in HttpListenerContext since it's already apart of .Net. Cleaned up code and build passes.
This commit is contained in:
@ -34,12 +34,12 @@ namespace MontoyaTech.Rest.Net.Example
|
||||
new Route(HttpRequestMethod.Get, "/json", Json)
|
||||
);
|
||||
|
||||
listener.RequestPreProcessEvent += (RouteListenerContext context) => {
|
||||
listener.RequestPreProcessEvent += (HttpListenerContext context) => {
|
||||
Console.WriteLine("Request start: " + context.Request.RawUrl);
|
||||
return true;
|
||||
};
|
||||
|
||||
listener.RequestPostProcessEvent += (RouteListenerContext context) =>
|
||||
listener.RequestPostProcessEvent += (HttpListenerContext context) =>
|
||||
{
|
||||
Console.WriteLine("Request end: " + context.Request.RawUrl);
|
||||
};
|
||||
@ -56,22 +56,22 @@ namespace MontoyaTech.Rest.Net.Example
|
||||
listener.Block();
|
||||
}
|
||||
|
||||
public static HttpListenerResponse Status(RouteListenerContext context)
|
||||
public static HttpListenerResponse Status(HttpListenerContext context)
|
||||
{
|
||||
return context.Response.WithStatus(HttpStatusCode.OK).WithText("Everything is operational. 👍");
|
||||
}
|
||||
|
||||
public static HttpListenerResponse Add(RouteListenerContext context, double a, double b)
|
||||
public static HttpListenerResponse Add(HttpListenerContext context, double a, double b)
|
||||
{
|
||||
return context.Response.WithStatus(HttpStatusCode.OK).WithText((a + b).ToString());
|
||||
}
|
||||
|
||||
public static HttpListenerResponse Signup(RouteListenerContext context, User user)
|
||||
public static HttpListenerResponse Signup(HttpListenerContext context, User user)
|
||||
{
|
||||
return context.Response.WithStatus(HttpStatusCode.OK).WithText("User:" + user.Name);
|
||||
}
|
||||
|
||||
public static HttpListenerResponse Json(RouteListenerContext context)
|
||||
public static HttpListenerResponse Json(HttpListenerContext context)
|
||||
{
|
||||
return context.Response.WithStatus(HttpStatusCode.OK).WithJson(new User("Rest.Net"));
|
||||
}
|
||||
|
Reference in New Issue
Block a user