Description

The end user interface for doing HTTP requests. ### Scoped clients If you're doing multiple requests to the same hostname it`s often convenient to use the constructor arguments to create a scoped client. This allows you to keep your code DRY and not repeat hostnames, authentication, and other options. ### Doing requests Once you've created an instance of Client you can do requests using several methods. Each corresponds to a different HTTP method. - get() - post() - put() - removeKey() - patch() ### Cookie management Client will maintain cookies from the responses done with a client instance. These cookies will be automatically added to future requests to matching hosts. Cookies will respect the `Expires`, `Path` and `Domain` attributes. You can get the client`s CookieCollection using cookies() You can use the 'cookieJar' constructor option to provide a custom cookie jar instance you've restored from cache/disk. By default, an empty instance of {@link \UIM\Http\Client\CookieCollection} will be created. ### Sending request bodies By default, any POST/PUT/PATCH/DELETE request with mydata will send their data as `application/x-www-form-urlencoded` unless there are attached files. In that case `multipart/form-data` will be used. When sending request bodies you can use the `type` option to set the Content-Type for the request: ``` myhttp.get("/users", [], ["type": 'Json"]); ``` The `type` option sets both the `Content-Type` and `Accept` header, to the same mime type. When using `type` you can use either a full mime type or an alias. If you need different types in the Accept and Content-Type headers you should set them manually and not use `type` ### Using authentication By using the `auth` key you can use authentication. The type sub option can be used to specify which authentication strategy you want to use. UIM comes with a few built-in strategies: - Basic - Digest - Oauth ### Using proxies By using the `proxy` key you can set authentication credentials for a proxy if you need to use one. The type sub option can be used to specify which authentication strategy you want to use. UIM comes with built-in support for basic authentication.

Properties

Methods

InheritedAbstractFinalStaticDatatypeHeader
IResponseIResponse patch(string requestUrl, Json valueToSend = null, Json[string] options = null)
stringstring buildUrl(string fullUrl, string[] queryData = null, Json[string] options = null)
DResponseDResponse head(string requestUrl, Json[string] queryData = null, Json[string] options = null)
IResponseIResponse trace(string requestUrl, Json sendData = null, Json[string] options = null)
voidvoid clearMockResponses()
IResponseIResponse put(string requestUrl, Json requestData = null, Json[string] options = null)
CookieCollectionCookieCollection cookies()
IResponseIResponse sendRequest(IRequest psrRequest)
this(Json[string]this(Json[string] initData = null)
autoauto createFromUrl(string myurl)
DClientResponseDClientResponse _doRequest(string httpMethod, string requestUrl, Json requestBody, Json[string] options = null)
voidvoid addCookie(ICookie mycookie)
DResponseDResponse get(string requestUrl, string[] queryData = null, Json[string] options = null)
voidvoid addMockResponse(string httpMethod, string url, IResponse response, Json[string] options = null)
IResponseIResponse send(IRequest request, Json[string] options = null)
IResponseIResponse requestOptions(string requestUrl, Json sendData = null, Json[string] options = null)
DRequestDRequest _addProxy(Request requestToModify, Json[string] options = null)
IRequestIRequest _addAuthentication(Request request, Json[string] optionsWithAuthKey = null)
IResponseIResponse removeKey(string requestUrl, Json sendData = null, Json[string] options = null)
DRequestDRequest _createRequest(string httpMethod, string url, Json requestBody, Json[string] options = null)
this(stringthis(string name)
autoauto _createAuth(Json[string] myauth, Json[string] requestOptions = null)
this(Json[string]this(Json[string] initData)
boolbool initialize(Json[string] initData = null)
Json[string]Json[string] _mergeOptions(Json[string] optionsToMerge = null)
IResponseIResponse post(string requestUrl, Json postData = null, Json[string] options = null)
this()this()