JanetDocsSourcePlaygroundI'm feeling luckyCommunityGitHub sign in

spork/http/read-request

spork


    function
    /usr/local/lib/janet/spork/http.janet on line 97, column 1

    (read-request conn buf &opt no-query)

    Read an HTTP request header from a connection. Returns a table with 
    the following keys:

    * `:headers` - table mapping header names to header values. Header 
      names are lowercase.
    * `:connection` - the connection stream for the header.
    * `:buffer` - the buffer instance that may contain extra bytes.
    * `:head-size` - the number of bytes used by the header.
    * `:method` - the HTTP method used.
    * `:path` - the path of the resource requested.

    The following keys are also present, but omitted if the user passes 
    a truthy parameter to `no-query`.

    * `:route` - path of the resource requested without query string.
    * `:query-string` - segment of HTTP path after first ? character.
    * `:query` - the query string parsed into a table. Supports a 
      single string value for every string key, and any query 
      parameters that aren't given a value are mapped to true.

    Note that data is read in chunks and any data after the header 
    terminator is stored in `:buffer`.


0 examplesSign in to add an example
Loading...