1.0.13 • Published 3 years ago
@domoskanonos/nidoca-http v1.0.13
nidoca-http
nidoca http helper classes to fetch data from server. based on web fetch api https://fetch.spec.whatwg.org/
project info | |
---|---|
npm | |
github |
HttpClientService usage in typescript
const httpClientProperties: HttpClientProperties = new HttpClientProperties();
httpClientProperties.baseURL = "http://localhost";
httpClientProperties.port = "8090";
const httpClientService : HttpClientService =
new HttpClientService(httpClientProperties),
const request: HttpClientRequest = httpClientService.getDefaultGetRequestInstance();
request.path = this.path.concat("/PATH");
request.requestMethod = HttpClientRequestType.POST;
request.body = {};
const response = await this.httpClient.request(request);
const bodyText: string = await response.text();
const myResponseBodyObject = JSON.parse(bodyText);