Class: abstract
HttpAgent
Defined in: packages/core/src/http/HttpAgent.ts:68
The HttpAgent defines unifying API for sending HTTP requests at both client-side and server-side.
Extended by
Constructors
new HttpAgent()
new HttpAgent():
HttpAgent
Returns
Methods
clearDefaultHeaders()
clearDefaultHeaders():
this
Defined in: packages/core/src/http/HttpAgent.ts:214
Clears all configured default headers.
Returns
this
This HTTP agent.
delete()
delete<
B
>(url
,data
?,options
?):Promise
<HttpAgentResponse
<B
>>
Defined in: packages/core/src/http/HttpAgent.ts:164
Sends an HTTP DELETE request to the specified URL, sending the provided data as the request body. If an object is provided as the request data, the data will be JSON-encoded. Sending other primitive non-string values as the request body is not supported.
Type Parameters
• B = unknown
Parameters
url
string
The URL to which the request should be made.
data?
The data to send to the server as the request body.
options?
Partial
<HttpAgentRequestOptions
>
Optional request options.
Returns
Promise
<HttpAgentResponse
<B
>>
A promise that resolves to the response.
get()
get<
B
>(url
,data
?,options
?):Promise
<HttpAgentResponse
<B
>>
Defined in: packages/core/src/http/HttpAgent.ts:80
Sends an HTTP GET request to the specified URL, sending the provided data as query parameters.
Type Parameters
• B = unknown
Parameters
url
string
The URL to which the request should be made.
data?
The data to send to the server as query parameters.
options?
Partial
<HttpAgentRequestOptions
>
Optional request options.
Returns
Promise
<HttpAgentResponse
<B
>>
A promise that resolves to the response.
getCacheKey()
getCacheKey(
method
,url
,data
):string
Defined in: packages/core/src/http/HttpAgent.ts:184
Generates a cache key to use for identifying a request to the specified URL using the specified HTTP method, submitting the provided data.
Parameters
method
string
The HTTP method used by the request.
url
string
The URL to which the request is sent.
data
The data associated with the request. These can be either the query parameters or request body data.
Returns
string
The key to use for identifying such a request in the cache.
invalidateCache()
invalidateCache(
method
,url
,data
):void
Defined in: packages/core/src/http/HttpAgent.ts:191
Method invalidate cache for given params
Parameters
method
string
url
string
data
Returns
void
patch()
patch<
B
>(url
,data
?,options
?):Promise
<HttpAgentResponse
<B
>>
Defined in: packages/core/src/http/HttpAgent.ts:143
Sends an HTTP PATCH request to the specified URL, sending the provided data as the request body. If an object is provided as the request data, the data will be JSON-encoded. Sending other primitive non-string values as the request body is not supported.
Type Parameters
• B = unknown
Parameters
url
string
The URL to which the request should be made.
data?
The data to send to the server as the request body.
options?
Partial
<HttpAgentRequestOptions
>
Optional request options.
Returns
Promise
<HttpAgentResponse
<B
>>
A promise that resolves to the response.
post()
post<
B
>(url
,data
?,options
?):Promise
<HttpAgentResponse
<B
>>
Defined in: packages/core/src/http/HttpAgent.ts:101
Sends an HTTP POST request to the specified URL, sending the provided data as the request body. If an object is provided as the request data, the data will be JSON-encoded. Sending other primitive non-string values as the request body is not supported.
Type Parameters
• B = unknown
Parameters
url
string
The URL to which the request should be made.
data?
The data to send to the server as the request body.
options?
Partial
<HttpAgentRequestOptions
>
Optional request options.
Returns
Promise
<HttpAgentResponse
<B
>>
A promise that resolves to the response.
put()
put<
B
>(url
,data
?,options
?):Promise
<HttpAgentResponse
<B
>>
Defined in: packages/core/src/http/HttpAgent.ts:122
Sends an HTTP PUT request to the specified URL, sending the provided data as the request body. If an object is provided as the request data, the data will be JSON-encoded. Sending other primitive non-string values as the request body is not supported.