RestInterfaceClient.request

Perform a request to the interface using the given parameters.

class RestInterfaceClient(I)
protected const
Json
request
(
HTTPMethod verb
,
string name
,
const scope ref InetHeaderMap hdrs
,
string query
,
string body_
,
ref InetHeaderMap reqReturnHdrs
,
ref InetHeaderMap optReturnHdrs
)

Parameters

verb HTTPMethod

Kind of request (See HTTPMethod enum).

name string

Location to request. For a request on https://github.com/rejectedsoftware/vibe.d/issues?q=author%3ASantaClaus, it will be '/rejectedsoftware/vibe.d/issues'.

hdrs InetHeaderMap

The headers to send. Some field might be overriden (such as Content-Length). However, Content-Type will NOT be overriden.

query string

The encoded query string. For a request on https://github.com/rejectedsoftware/vibe.d/issues?q=author%3ASantaClaus, it will be 'author%3ASantaClaus'.

body_ string

The body to send, as a string. If a Content-Type is present in hdrs, it will be used, otherwise it will default to the generic type "application/json".

reqReturnHdrs InetHeaderMap

A map of required return headers. To avoid returning unused headers, nothing is written to this structure unless there's an (usually empty) entry (= the key exists) with the same key. If any key present in reqReturnHdrs is not present in the response, an Exception is thrown.

optReturnHdrs InetHeaderMap

A map of optional return headers. This behaves almost as exactly as reqReturnHdrs, except that non-existent key in the response will not cause it to throw, but rather to set this entry to 'null'.

Return Value

Type: Json

The Json object returned by the request

Meta