insomnia/packages/insomnia-app/app/plugins/context/network.ts
Dimitri Mitropoulos 5f4c19da35
[TypeScript] Phase 1 & 2 (#3370)
Co-authored-by: Opender Singh <opender.singh@konghq.com>
2021-05-12 18:35:00 +12:00

17 lines
627 B
TypeScript

import { send } from '../../network/network';
import type { Request } from '../../models/request';
import * as models from '../../models';
import type { ExtraRenderInfo } from '../../common/render';
export function init(activeEnvironmentId: string | null) {
return {
network: {
async sendRequest(request: Request, extraInfo?: ExtraRenderInfo) {
const responsePatch = await send(request._id, activeEnvironmentId || undefined, extraInfo);
const settings = await models.settings.getOrCreate();
return models.response.create(responsePatch, settings.maxHistoryResponses);
},
},
};
}