insomnia/packages/insomnia-app/app/plugins/context/network.js
Gregory Schier a83596299a
Fix Response Tag infinite recursion (#1502)
* Improvements to Response tag recursion and rendering (Fixes #1500)

* Add tests for response tag dependency sending
2019-05-15 16:01:36 -04:00

19 lines
664 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, extraInfo);
const settings = await models.settings.getOrCreate();
return models.response.create(responsePatch, settings.maxHistoryResponses);
},
};
return { network };
}