@zxteam/web-client
v6.0.66
Published
ZXTeam's Web Client. CancellationToken and Limit are supported.
Downloads
5
Readme
ZXTeam's Web Client
Examples (TypeScript)
Simple HTTP request: test/examples/typescript/example001.ts
const webClient = new WebClient("http://httpbin.org");
try {
const response: WebClient.Response = await webClient.get(cancellationToken, "ip");
const statusCode: number = response.statusCode;
const statusMessage: string = response.statusMessage;
const headers: http.IncomingHttpHeaders = response.headers;
const body: Buffer = response.body;
const bodyJson: any = response.bodyAsJson;
console.log(statusCode);
console.log(statusMessage);
console.log(headers);
console.log(body.toString());
console.log(bodyJson);
} finally {
await webClient.dispose();
}