This module contains a definition of HTTP version.
Types
HttpVersion = tuple[orig: string, major: Natural, minor: Natural]
- HTTP version number. orig means the original string form, such as "HTTP/1.1". major represents the major version number, and minor represents the minor version number. Source Edit
Consts
HttpVersion10 = "HTTP/1.0"
- Source Edit
HttpVersion11 = "HTTP/1.1"
- Source Edit
HttpVersion20 = "HTTP/2.0"
- Source Edit
Procs
proc parseHttpVersion(s: string): HttpVersion {...}{.raises: [ValueError], tags: [].}
-
Converts a string to HTTP version. A ValueError is raised when s is not a valid version. Currently only "HTTP/1.0" and "HTTP/1.1" are valid versions.
Examples:
let version = parseHttpVersion("HTTP/1.1") assert version.orig == "HTTP/1.1" assert version.major == 1 assert version.minor == 1
Source Edit