HttpRequest Type

A holder for the data extracted from the request.

Record fields

Record Field Description

binding

Full Usage: binding

Field type: HttpBinding
Field type: HttpBinding

files

Full Usage: files

Field type: List<HttpUpload>
Field type: List<HttpUpload>

headers

Full Usage: headers

Field type: List<string * string>
Field type: List<string * string>

httpVersion

Full Usage: httpVersion

Field type: string
Field type: string

multiPartFields

Full Usage: multiPartFields

Field type: List<string * string>
Field type: List<string * string>

rawForm

Full Usage: rawForm

Field type: byte[]
Field type: byte[]

rawHost

Full Usage: rawHost

Field type: string
Field type: string

rawMethod

Full Usage: rawMethod

Field type: string
Field type: string

rawPath

Full Usage: rawPath

Field type: string
Field type: string

rawQuery

Full Usage: rawQuery

Field type: string
Field type: string

Instance members

Instance member Description

this[key]

Full Usage: this[key]

Parameters:
    key : string

Returns: string option

Syntactic Sugar to retrieve query string, form or multi-field values from `HttpRequest`

key : string
Returns: string option

this.clientHost trustProxy sources

Full Usage: this.clientHost trustProxy sources

Parameters:
    trustProxy : bool
    sources : string list

Returns: Host

Get the client's view of what host is being called. If you trust your proxy the value will be fetched from `X-Forwarded-Host`, then the `Host` headers. If you don't explicitly overwrite these headers in the proxy you may be open to clients spoofing the headers. Hence the explicit interfaces which force you as a developer to think about the problem.

trustProxy : bool
sources : string list
Returns: Host

this.clientHostTrustProxy

Full Usage: this.clientHostTrustProxy

Returns: Host

See docs on `clientHost`

Returns: Host

this.fieldData key

Full Usage: this.fieldData key

Parameters:
    key : string

Returns: Choice<string, string>

Finds the key k from the multipart-form of the `HttpRequest`. To access query string parameters, use `queryParam` or to access regular form data, use `formData`.

key : string
Returns: Choice<string, string>

this.form

Full Usage: this.form

Returns: (string * string option) list

Gets the form as a `((string * string option) list)` from the HttpRequest. Use `formData` to get the data for a particular key or use the indexed property in the `HttpRequest`.

Returns: (string * string option) list

this.formData key

Full Usage: this.formData key

Parameters:
    key : string

Returns: Choice<string, string>

Finds the key k from the form of the `HttpRequest`. To access query string parameters, use `queryParam` or to access multipart form fields, use `fieldData`.

key : string
Returns: Choice<string, string>

this.header key

Full Usage: this.header key

Parameters:
    key : string

Returns: Choice<string, string>

Gets the header for the given key in the `HttpRequest`

key : string
Returns: Choice<string, string>

this.host

Full Usage: this.host

Returns: Host

The `Host` that the web server responds to; not necessarily the host called by the client, as the request may have traversed proxies. As Suave binds to an IP rather than IP+Hostname, this can be anything the client has passed as the Host header. If you're behind a proxy, it may be the DNS name of the node that the reverse proxy forwards to, or if you're exposing Suave publically, it should match the public DNS name of the node. To ensure the correct host-name is being called, you can use `Http.host` in your web app.

Returns: Host

this.method

Full Usage: this.method

Returns: HttpMethod

Returns a `HttpMethod`

Returns: HttpMethod

this.path

Full Usage: this.path

Returns: string

path is equal to `UrlDecode(rawPath)`

Returns: string

this.query

Full Usage: this.query

Returns: (string * string option) list

Gets the query string from the `HttpRequest` as a list of `(key, value option)` tuples. If a key is present without value, the entry will be `(key, None)`. It will be `(key, Some value)` otherwise. If a key is present multiple times in the URL, this list will contain multiple entries. Use `queryParam` to try to fetch data for individual items.

Returns: (string * string option) list

this.queryFlag flag

Full Usage: this.queryFlag flag

Parameters:
    flag : string

Returns: bool

Check the query string for a `flag`: - `?flag` => `true` - `?flag=false` => `false` - `?flag=apa` => `false` - `?flag=true` => `true` - `?` => `false`

flag : string
Returns: bool

this.queryParam key

Full Usage: this.queryParam key

Parameters:
    key : string

Returns: Choice<string, string>

Gets the value of the first matching query parameter with `key` in the `HttpRequest` as `Choice1Of2`. The `key` comparison is case-sensitive. If `key` is not present, or no value is present for the first occurrence of `key`, an error is returned as `Choice2Of2`. To access form data, use either `formData` to access normal form data, or `fieldData` to access the multipart-fields.

key : string
Returns: Choice<string, string>

this.queryParamOpt key

Full Usage: this.queryParamOpt key

Parameters:
    key : string

Returns: (string * string option) option

Finds the first matching query parameter with `key` in the `HttpRequest` and returns - `None` if no matching parameter was found, - `(key, None)` if a matching parameter was found, but without value, or - `(key, Some value)` if a matching parameter was found.

key : string
Returns: (string * string option) option

this.url

Full Usage: this.url

Returns: Uri

Returns `Uri` object representing the url associated with this request

Returns: Uri