core/beast/request

Types

NativeRequest = httpx.Request
  Source Edit
Request = object
  nativeRequest*: NativeRequest
  cookies*: CookieJar
  httpMethod: HttpMethod
  headers: HttpHeaders
  url: Uri
  postParams*: StringTableRef
  queryParams*: StringTableRef
  formParams*: FormPart
  pathParams*: StringTableRef
  Source Edit

Procs

proc send(request: Request; content: string): Future[void] {...}{.inline,
    raises: [ValueError, IOSelectorsException, Exception], tags: [RootEffect].}
Sends content to the client.   Source Edit
proc respond(request: Request; code: HttpCode; body: string): Future[void] {...}{.
    inline, raises: [ValueError, IOSelectorsException, Exception],
    tags: [RootEffect].}
Responds code, body to the client, the framework will generate the contents of the response automatically.   Source Edit
proc respond(request: Request; code: HttpCode; body: string;
             headers: ResponseHeaders): Future[void] {...}{.inline,
    raises: [ValueError, IOSelectorsException, KeyError, Exception],
    tags: [RootEffect].}
Responds code, body and headers to the client, the framework will generate the contents of the response automatically.   Source Edit
proc respond(request: Request; response: Response): Future[void] {...}{.inline,
    raises: [ValueError, IOSelectorsException, KeyError, Exception],
    tags: [RootEffect].}
Responds response to the client, the framework will generate the contents of the response automatically.   Source Edit
proc close(request: Request) {...}{.raises: [ValueError, IOSelectorsException],
                               tags: [].}
Closes the request.   Source Edit

Funcs

func url(request: Request): Uri {...}{.inline, raises: [], tags: [].}
Gets the url of the request.   Source Edit
func port(request: Request): string {...}{.inline, raises: [], tags: [].}
Gets the port of the request.   Source Edit
func path(request: Request): string {...}{.inline, raises: [], tags: [].}
Gets the path of the request.   Source Edit
func stripPath(request: var Request) {...}{.inline, raises: [], tags: [].}
Strips the path of the request.   Source Edit
func query(request: Request): string {...}{.inline, raises: [], tags: [].}
Gets the query strings of the request.   Source Edit
func scheme(request: Request): string {...}{.inline, raises: [], tags: [].}
Gets the scheme of the request.   Source Edit
func setScheme(request: var Request; value: string) {...}{.inline, raises: [],
    tags: [].}
Sets the scheme of the request.   Source Edit
func body(request: Request): string {...}{.inline, raises: [KeyError, ValueError],
                                      tags: [].}
Gets the body of the request. It is only present when using HttpPost method.   Source Edit
func headers(request: Request): HttpHeaders {...}{.inline, raises: [], tags: [].}
Gets the HttpHeaders of the request.   Source Edit
func reqMethod(request: Request): HttpMethod {...}{.inline, raises: [], tags: [].}
Gets the HttpMethod of the request.   Source Edit
func getCookie(request: Request; key: string; default: string): string {...}{.inline,
    raises: [], tags: [].}
Gets the value of request.cookies[key] if key is in cookies. Otherwise, the default value will be returned.   Source Edit
func contentType(request: Request): string {...}{.inline, raises: [KeyError],
    tags: [].}
Gets the contentType of the request.   Source Edit
func charset(request: Request): string {...}{.inline, raises: [KeyError], tags: [].}
Gets the charset of the request.   Source Edit
func secure(request: Request): bool {...}{.inline, raises: [KeyError], tags: [].}
Returns True if the request is secure.   Source Edit
func hostName(request: Request): string {...}{.inline, raises: [KeyError], tags: [].}
Gets the hostname of the request.   Source Edit
func initRequest(nativeRequest: NativeRequest; cookies = initCookieJar();
                 pathParams = newStringTable(modeCaseSensitive);
                 queryParams = newStringTable(modeCaseSensitive);
                 postParams = newStringTable(modeCaseSensitive)): Request {...}{.
    raises: [KeyError], tags: [].}
Initializes a new Request.   Source Edit
func initMockingRequest(httpMethod: HttpMethod; headers: HttpHeaders; url: Uri;
                        cookies = initCookieJar();
                        postParams = newStringTable();
                        queryParams = newStringTable();
                        formParams = initFormPart();
                        pathParams = newStringTable()): Request {...}{.raises: [],
    tags: [].}
Initializes a new Request.   Source Edit