netkit/http/httpmethod

    Dark Mode
Search:
Group by:

This module contains a definition of HTTP request method.

Overview

HTTP defines methods to indicate the desired action to be performed on the identified resource. What this resource represents, whether pre-existing data or data that is generated dynamically, depends on the implementation of the server. Often, the resource corresponds to a file or the output of an executable residing on the server.

See Hypertext Transfer Protocol for more information.

Types

HttpMethod = enum
  HttpHead = "HEAD",
  HttpGet = "GET",
  HttpPost = "POST",
  HttpPut = "PUT",
  HttpDelete = "DELETE",
  HttpTrace = "TRACE",
  HttpOptions = "OPTIONS",
  HttpConnect = "CONNECT",
  HttpPatch = "PATCH"
HTTP request method.   Source Edit

Procs

proc parseHttpMethod(s: string): HttpMethod {...}{.raises: [ValueError], tags: [].}

Converts a string to an HTTP request method. A ValueError is raised when s is not a valid method.

Examples:

assert parseHttpMethod("GET") == HttpGet
assert parseHttpMethod("POST") == HttpPost
  Source Edit