aboutsummaryrefslogtreecommitdiff
path: root/packages/taler-harness/src/harness
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2023-01-11 17:12:08 +0100
committerFlorian Dold <florian@dold.me>2023-01-11 17:14:49 +0100
commit143a4fe4ac5b8724cf6e13a704e88daa99dd4202 (patch)
tree07b2fe6d993ae46838bc4072db8eba609bbb1801 /packages/taler-harness/src/harness
parent5fc0cb7927e7a81a80129f6165b2027e72b89d33 (diff)
downloadwallet-core-143a4fe4ac5b8724cf6e13a704e88daa99dd4202.tar.xz
wallet-core: refresh when aborting payments
Diffstat (limited to 'packages/taler-harness/src/harness')
-rw-r--r--packages/taler-harness/src/harness/faultInjection.ts17
1 files changed, 16 insertions, 1 deletions
diff --git a/packages/taler-harness/src/harness/faultInjection.ts b/packages/taler-harness/src/harness/faultInjection.ts
index 4c3d0c123..f4d7fc4b9 100644
--- a/packages/taler-harness/src/harness/faultInjection.ts
+++ b/packages/taler-harness/src/harness/faultInjection.ts
@@ -47,6 +47,10 @@ export interface FaultInjectionRequestContext {
requestHeaders: Record<string, string | string[] | undefined>;
requestBody?: Buffer;
dropRequest: boolean;
+ // These are only used when the request is dropped
+ substituteResponseBody?: Buffer;
+ substituteResponseStatusCode?: number;
+ substituteResponseHeaders?: Record<string, string | string[] | undefined>;
}
export interface FaultInjectionResponseContext {
@@ -101,7 +105,18 @@ export class FaultProxy {
}
if (faultReqContext.dropRequest) {
- res.destroy();
+ if (faultReqContext.substituteResponseStatusCode) {
+ const statusCode = faultReqContext.substituteResponseStatusCode;
+ res.writeHead(
+ statusCode,
+ http.STATUS_CODES[statusCode],
+ faultReqContext.substituteResponseHeaders,
+ );
+ res.write(faultReqContext.substituteResponseBody);
+ res.end();
+ } else {
+ res.destroy();
+ }
return;
}