Livt packages
Livt.Web
Version 1.0.0
Bounded HTTP routing, request parsing, response encoding, and Ethernet application composition for Livt.
Published files (63)
- HttpAllowedMethods.lvt
- HttpApplication.lvt
- HttpApplicationState.lvt
- HttpContentType.lvt
- HttpHeaderName.lvt
- HttpMatchResult.lvt
- HttpMethod.lvt
- HttpNetworkEndpoint.lvt
- HttpNetworkResponse.lvt
- HttpPath.lvt
- HttpPreparation.lvt
- HttpRequestCursor.lvt
- HttpRequestHeaders.lvt
- HttpRequestLine.lvt
- HttpRequestParser.lvt
- HttpRequestResult.lvt
- HttpRequestSyntax.lvt
- HttpResponse.lvt
- HttpResponseEncoder.lvt
- HttpResponseSyntax.lvt
- HttpRouteFallback.lvt
- HttpRouteMethods.lvt
- HttpRouter.lvt
- HttpServer.lvt
- HttpStatus.lvt
- HttpTcpFrame.lvt
- HttpTcpSequence.lvt
- HttpTcpState.lvt
- HttpTcpTransport.lvt
- HttpTransportPayload.lvt
- HttpTransportState.lvt
- HttpVersion.lvt
- IHttpApplication.lvt
- IHttpHandler.lvt
- IHttpRequest.lvt
- IHttpResponse.lvt
- IHttpRoute.lvt
- IHttpRouteMatcher.lvt
- Route.lvt
- RouteChain.lvt
- RouteDispatch.lvt
- RouteSelection.lvt
- StaticContent.lvt
src/http/HttpRouteMethods.lvt
namespace Livt.Web.Http
using Livt.Net
/**
* Stateless method-set operations; Other is not a wildcard route method.
*/
class HttpRouteMethods
{
/**
* Maps GET/HEAD to their singleton Allow set; Other maps to None, never a wildcard.
*/
public static inline fn FromMethod[](method: HttpMethod) HttpAllowedMethods
{
if (method == HttpMethod.Get) {
return HttpAllowedMethods.Get
}
if (method == HttpMethod.Head) {
return HttpAllowedMethods.Head
}
return HttpAllowedMethods.None
}
/**
* Combines two supported method sets without duplicates; None is the identity.
*/
public static inline fn Union[](first: HttpAllowedMethods, second: HttpAllowedMethods) HttpAllowedMethods
{
if (first == HttpAllowedMethods.None) {
return second
}
if (second == HttpAllowedMethods.None || first == second) {
return first
}
return HttpAllowedMethods.GetAndHead
}
}