Skip to content

Commit

Permalink
feat: add after-response script step to the progress
Browse files Browse the repository at this point in the history
  • Loading branch information
ihexxa committed May 29, 2024
1 parent f39f957 commit 3afb742
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/insomnia/src/network/request-timing.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
type StepName = 'Executing pre-request script' | 'Rendering request' | 'Preparing and sending request';
type StepName = 'Executing pre-request script' | 'Rendering request' | 'Preparing and sending request' | 'Executing after-response script';

export interface TimingRecord {
stepName: StepName;
Expand Down
10 changes: 10 additions & 0 deletions packages/insomnia/src/ui/routes/request.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,16 @@ export const sendAction: ActionFunction = async ({ request, params }) => {
const is2XXWithBodyPath = responsePatch.statusCode && responsePatch.statusCode >= 200 && responsePatch.statusCode < 300 && responsePatch.bodyPath;
const shouldWriteToFile = shouldPromptForPathAfterResponse && is2XXWithBodyPath;
if (requestData.request.afterResponseScript) {
addRequestTimingRecord(
requestId,
{
stepName: 'Executing after-response script',
isDone: false,
startedAt: Date.now(),
endedAt: 0,
},
);

const baseEnvironment = await models.environment.getOrCreateForParentId(workspaceId);
const cookieJar = await models.cookieJar.getOrCreateForParentId(workspaceId);
const postMutatedContext = await tryToExecuteAfterResponseScript({
Expand Down

0 comments on commit 3afb742

Please sign in to comment.