Skip to content

Commit

Permalink
update MapContainer to MapDescriptor
Browse files Browse the repository at this point in the history
  • Loading branch information
alec1o committed Jun 27, 2024
1 parent c012ed9 commit 717433c
Showing 1 changed file with 3 additions and 31 deletions.
34 changes: 3 additions & 31 deletions src/http/partials/Server/Map.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ internal class Map : IHTTP.Map
{
internal const string ALL_MEHOD = "*";

public readonly List<MapContainer> m_mapList;
public readonly List<MapDescriptor> m_mapList;

public readonly Server m_server;

public Map(Server server)
{
m_server = server;
m_mapList = new List<MapContainer>();
m_mapList = new List<MapDescriptor>();
}

public void WebSocket(string path, Action<IHTTP.ServerRequest, IHTTP.WebSocket> callback)
Expand Down Expand Up @@ -159,7 +159,7 @@ private void Add

if (Path.IsValid(path))
{
var map = new MapContainer
var map = new MapDescriptor
(
path,
Path.IsParamPath(path),
Expand All @@ -171,34 +171,6 @@ private void Add
m_mapList.Add(map);
}
}

internal struct MapContainer
{
public bool UseParams { get; }
public string Path { get; }
public string Method { get; }
public bool IsWebsocket { get; }
public Action<IHTTP.ServerRequest, IHTTP.ServerResponse> HttpCallback { get; }
public Action<IHTTP.ServerRequest, WebSocket> WebsocketCallback { get; }

public MapContainer
(
string path,
bool useParams,
string method,
bool isWebsocket,
Action<IHTTP.ServerRequest, IHTTP.ServerResponse> httpCallback,
Action<IHTTP.ServerRequest, WebSocket> websocketCallback
)
{
Path = path;
UseParams = useParams;
Method = method;
IsWebsocket = isWebsocket;
HttpCallback = httpCallback;
WebsocketCallback = websocketCallback;
}
}
}
}
}

0 comments on commit 717433c

Please sign in to comment.