Skip to content

Commit 15920de

Browse files
committed
feat: allow to keep responses
1 parent 846ef2c commit 15920de

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/httpApiMock.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,17 @@ export const steps = ({
2727
regExpMatchedStep(
2828
{
2929
regExp:
30-
/^this HTTP API Mock response for `(?<methodHostPathQuery>[A-Z]+ http?s:\/\/[^`]+)` is queued$/,
30+
/^this HTTP API Mock response for `(?<methodHostPathQuery>[A-Z]+ http?s:\/\/[^`]+)` is queued( and kept)?$/,
3131
schema: Type.Object({
3232
methodHostPathQuery: Type.String(),
33+
keep: Type.Optional(Type.Literal(' and kept')),
3334
}),
3435
},
35-
async ({ match: { methodHostPathQuery }, log: { progress }, step }) => {
36+
async ({
37+
match: { methodHostPathQuery, keep },
38+
log: { progress },
39+
step,
40+
}) => {
3641
const [method, hostPathQuery] = methodHostPathQuery.split(' ')
3742
if (method === undefined) throw new Error(`Method is undefined!`)
3843
if (hostPathQuery === undefined)
@@ -63,6 +68,7 @@ export const steps = ({
6368
queryParams:
6469
query !== undefined ? new URLSearchParams(query) : undefined,
6570
statusCode: response.statusCode,
71+
keep: keep !== undefined,
6672
})
6773
},
6874
),

0 commit comments

Comments
 (0)