source: binary-improvements2/WebServer/src/RequestContext.cs@ 433

Last change on this file since 433 was 426, checked in by alloc, 19 months ago

*Updated web permissions system
*Fixed webpermissions command
*Moved API "webmods" to "mods", also lists non-webmod mods

File size: 972 bytes
RevLine 
[391]1using SpaceWizards.HttpListener;
2
3namespace Webserver {
4 public class RequestContext {
5 public string RequestPath;
[415]6 public readonly ERequestMethod Method;
[391]7 public readonly HttpListenerRequest Request;
8 public readonly HttpListenerResponse Response;
9 public readonly WebConnection Connection;
10 public readonly int PermissionLevel;
11
12 public RequestContext (string _requestPath, HttpListenerRequest _request, HttpListenerResponse _response, WebConnection _connection, int _permissionLevel) {
13 RequestPath = _requestPath;
14 Request = _request;
15 Response = _response;
16 Connection = _connection;
17 PermissionLevel = _permissionLevel;
[415]18 Method = _request.HttpMethod switch {
19 "GET" => ERequestMethod.GET,
20 "PUT" => ERequestMethod.PUT,
21 "POST" => ERequestMethod.POST,
22 "DELETE" => ERequestMethod.DELETE,
23 "HEAD" => ERequestMethod.HEAD,
24 "OPTIONS" => ERequestMethod.OPTIONS,
25 _ => ERequestMethod.Other
26 };
[391]27 }
28 }
29}
Note: See TracBrowser for help on using the repository browser.