Added ReadAsForm to the RequestExtensions to help with reading form data. Bumped package verison to 1.6.0
This commit is contained in:
@ -82,7 +82,8 @@ namespace MontoyaTech.Rest.Net.Example
|
||||
new Route(HttpRequestMethod.Get, "/auth/", Json),
|
||||
new Route(HttpRequestMethod.Get, "/auth/role", GetRole),
|
||||
new Route(HttpRequestMethod.Post, "/upload", Upload),
|
||||
new Route(HttpRequestMethod.Get, "/download", Download)
|
||||
new Route(HttpRequestMethod.Get, "/download", Download),
|
||||
new Route(HttpRequestMethod.Post, "/form", FormTest)
|
||||
);
|
||||
|
||||
string code = listener.GenerateCSharpClient();
|
||||
@ -224,5 +225,12 @@ namespace MontoyaTech.Rest.Net.Example
|
||||
{
|
||||
return context.Response.WithStatus(HttpStatusCode.OK).WithText("Hello world");
|
||||
}
|
||||
|
||||
[RouteGroup("Form")]
|
||||
[RouteResponse(typeof(Dictionary<string, string>))]
|
||||
public static HttpListenerResponse FormTest(HttpListenerContext context)
|
||||
{
|
||||
return context.Response.WithStatus(HttpStatusCode.OK).WithJson(context.Request.ReadAsForm());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user