src/prologue/core/naive/request

Search:
Group by:
Source   Edit  

Types

NativeRequest = asyncHttpServer.Request
Source   Edit  
Request = object
  nativeRequest*: NativeRequest
  cookies*: CookieJar
  postParams*: StringTableRef
  queryParams*: StringTableRef
  formParams*: FormPart
  pathParams*: StringTableRef
Source   Edit  

Procs

func body(request: Request): string {.inline, ...raises: [], tags: [], forbids: [].}
Gets the body of the request. It is only present when using HttpPost method. Source   Edit  
func charset(request: Request): string {.inline, ...raises: [KeyError], tags: [],
    forbids: [].}
Gets the charset of the request. Source   Edit  
proc close(request: Request) {....raises: [LibraryError, Exception, SslError],
                               tags: [RootEffect], forbids: [].}
Closes the request. Source   Edit  
func contentType(request: Request): string {.inline, ...raises: [KeyError],
    tags: [], forbids: [].}
Gets the contentType of the request. Source   Edit  
func getCookie(request: Request; key: string; default = ""): string {.inline,
    ...raises: [], tags: [], forbids: [].}
Gets the value of request.cookies[key] if key is in cookies. Otherwise, the default value will be returned. Source   Edit  
func headers(request: Request): HttpHeaders {.inline, ...raises: [], tags: [],
    forbids: [].}
Gets the HttpHeaders of the request. Source   Edit  
func hostName(request: Request): string {.inline, ...raises: [KeyError], tags: [],
    forbids: [].}
Gets the hostname of the request. Source   Edit  
func initMockingRequest(httpMethod: HttpMethod; headers: HttpHeaders; url: Uri;
                        cookies = initCookieJar();
                        postParams = newStringTable();
                        queryParams = newStringTable();
                        formParams = initFormPart();
                        pathParams = newStringTable()): Request {....raises: [],
    tags: [], forbids: [].}
Initializes a new Request. Source   Edit  
func initRequest(nativeRequest: NativeRequest; cookies = initCookieJar();
                 pathParams = newStringTable(modeCaseSensitive);
                 queryParams = newStringTable(modeCaseSensitive);
                 postParams = newStringTable(modeCaseSensitive)): Request {.
    inline, ...raises: [], tags: [], forbids: [].}
Initializes a new Request. Source   Edit  
func path(request: Request): string {.inline, ...raises: [], tags: [], forbids: [].}
Gets the path of the request. Source   Edit  
func port(request: Request): string {.inline, ...raises: [], tags: [], forbids: [].}
Gets the port of the request. Source   Edit  
func query(request: Request): string {.inline, ...raises: [], tags: [], forbids: [].}
Gets the query strings of the request. Source   Edit  
func reqMethod(request: Request): HttpMethod {.inline, ...raises: [], tags: [],
    forbids: [].}
Gets the HttpMethod of the request. Source   Edit  
proc respond(request: Request; code: HttpCode; body: string): Future[void] {.
    inline, ...raises: [Exception], tags: [RootEffect], forbids: [].}
Responds code, body to the client, the framework will generate response contents automatically. Source   Edit  
proc respond(request: Request; code: HttpCode; body: string;
             headers: ResponseHeaders): Future[void] {.inline,
    ...raises: [Exception], tags: [RootEffect], forbids: [].}
Responds code, body and headers to the client, the framework will generate response contents automatically. Source   Edit  
proc respond(request: Request; response: Response): Future[void] {.inline,
    ...raises: [Exception], tags: [RootEffect], forbids: [].}
Responds response to the client, the framework will generate response contents automatically. Source   Edit  
func scheme(request: Request): string {.inline, ...raises: [], tags: [],
                                        forbids: [].}
Gets the scheme of the request. Source   Edit  
func secure(request: Request): bool {.inline, ...raises: [KeyError], tags: [],
                                      forbids: [].}
Returns True if the request is secure. Source   Edit  
proc send(request: Request; content: string): Future[void] {.inline,
    ...raises: [Exception], tags: [RootEffect], forbids: [].}
Sends content to the client. Source   Edit  
func setScheme(request: var Request; value: string) {.inline, ...raises: [],
    tags: [], forbids: [].}
Sets the scheme of the request. Source   Edit  
func stripPath(request: var Request) {.inline, ...raises: [], tags: [], forbids: [].}
Strips the path of the request. Source   Edit  
func url(request: Request): Uri {.inline, ...raises: [], tags: [], forbids: [].}
Gets the url of the request. Source   Edit