UNPKG

egg

Version:

A web application framework for Node.js

29 lines (28 loc) • 652 B
//#region src/lib/core/context_httpclient.ts var ContextHttpClient = class { ctx; app; constructor(ctx) { this.ctx = ctx; this.app = ctx.app; } /** * http request helper base on {@link HttpClient}, it will auto save httpclient log. * Keep the same api with {@link Application#curl}. * * @param {String|Object} url - request url address. * @param {Object} [options] - options for request. */ async curl(url, options) { options = { ...options, ctx: this.ctx }; return await this.app.curl(url, options); } async request(url, options) { return await this.curl(url, options); } }; //#endregion export { ContextHttpClient };