mirror of
https://github.com/Kong/insomnia
synced 2024-11-12 17:26:32 +00:00
de2fc0ba42
* Scope responses to active environment * Update response history to support scoped envs
19 lines
677 B
JavaScript
19 lines
677 B
JavaScript
// @flow
|
|
|
|
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): { network: Object } {
|
|
const network = {
|
|
async sendRequest(request: Request, extraInfo?: ExtraRenderInfo): Promise<Response> {
|
|
const responsePatch = await send(request._id, activeEnvironmentId || undefined, extraInfo);
|
|
const settings = await models.settings.getOrCreate();
|
|
return models.response.create(responsePatch, settings.maxHistoryResponses);
|
|
},
|
|
};
|
|
|
|
return { network };
|
|
}
|