1.2.2 • Published 6 years ago

@dlcs/provider-angular-http v1.2.2

Weekly downloads
1
License
MIT
Repository
github
Last release
6 years ago

DLCS Angular HttpClient Provider

status npm

Resource provider for Angular HttpClient.

Configuration

NameDefault valueUsage
server.address''Default server address from remote protocol
server.responseType'json'Default response type
server.contentType'application/json'Default content type
assets.address''Default address from assets protocol

Supported protocol

  • remote for access default server defined in Configuration.
  • assets for access staic files defined in Configuration.
  • http for access http address.
  • https for access https address.

Request parameters

NameDefault valueDescription
responseTypeSet by configurationRespnse type
contentTypeSet by configurationContent type
methodXHRMethod.GETRequest http method.
headersundefinedExtra headers
querysundefinedURL query parameters
bodyundefinedRequest body, only affects POST/PUT/PATCH
timeoutundefinedRequest timeout, do not set this value or set to 0 to disable timeout.

Structure defined as AngularHttpRequestParams.

Supported mode

ProtocolAsynchronizedSynchronizedRequestSubmitDelete
remote×
assets×××
http×
https×

Injectors

TimepointData structureData descriptionRequest method
BeforeSendAngularHttpRequestDataRequest parametersRequest/Submit/Delete
AfterSentObservable<any>Response from HttpClientRequest/Submit/Delete

See AngularHttpRequestData's definition.

Example

resourceManager.registerProtocol(new AngularHttpProtocol(this.httpClient)); // Angular HttpClient from Angular DI
// Request data
resourceManager.request.to(`http://www.google.com`).tag('google').send();
// Request using default server
http.config.server.address = 'http://www.a.org';
resourceManager.request.to(`remote:///test.txt`).tag('test').send();
// Request static file
http.config.assets.address = '/assets';
resourceManager.request.to(`assets:///test.txt`).tag('test_local').send();
// POST data
resourceManager.request.to(`http://www.test.org`).param({ method: XHRMethod.POST }).tag('google').send();
1.2.2

6 years ago

1.2.1

6 years ago

1.2.0

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago