source: TFP-WebServer/WebServer/src/RequestContext.cs@ 440

Last change on this file since 440 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
Line 
1using SpaceWizards.HttpListener;
2
3namespace Webserver {
4 public class RequestContext {
5 public string RequestPath;
6 public readonly ERequestMethod Method;
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;
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 };
27 }
28 }
29}
Note: See TracBrowser for help on using the repository browser.