insomnia/packages/insomnia-app/app/plugins/context/network.js
2019-05-04 16:34:52 -04:00

18 lines
564 B
JavaScript

// @flow
import { send } from '../../network/network';
import type { Request } from '../../models/request';
import * as models from '../../models';
export function init(activeEnvironmentId: string | null): { network: Object } {
const network = {
async sendRequest(request: Request): Promise<Response> {
const responsePatch = await send(request._id, activeEnvironmentId);
const settings = await models.settings.getOrCreate();
return models.response.create(responsePatch, settings.maxHistoryResponses);
},
};
return { network };
}