From ac0f1cbd4f262905a41ef867dce417e87f6ea7ae Mon Sep 17 00:00:00 2001
From: holomekc <30546982+holomekc@users.noreply.github.com>
Date: Tue, 9 Apr 2024 08:00:33 +0200
Subject: [PATCH] fix: missing serve event listeners
- Adjust stub mapping model and add serve event listener
- Adjust other missing values in other models
- Add helper to add webhooks
---
.../mappings/mapping-helper.service.ts | 22 +++++++++++++++++++
.../mappings/mappings.component.html | 16 ++++++++++++++
.../components/mappings/mappings.component.ts | 4 ++++
.../src/app/model/wiremock/logged-request.ts | 8 +++++--
.../app/model/wiremock/response-definition.ts | 2 ++
.../serve-event-listener-definition.ts | 15 +++++++++++++
.../src/app/model/wiremock/stub-mapping.ts | 4 ++++
7 files changed, 69 insertions(+), 2 deletions(-)
create mode 100644 webapp/wiremock/src/app/model/wiremock/serve-event-listener-definition.ts
diff --git a/webapp/wiremock/src/app/components/mappings/mapping-helper.service.ts b/webapp/wiremock/src/app/components/mappings/mapping-helper.service.ts
index 8cf2f90c28..3a68b4b754 100644
--- a/webapp/wiremock/src/app/components/mappings/mapping-helper.service.ts
+++ b/webapp/wiremock/src/app/components/mappings/mapping-helper.service.ts
@@ -145,4 +145,26 @@ export class MappingHelperService {
}
return undefined;
}
+
+ static helperAddWebhook(mapping?: StubMapping): StubMapping | undefined {
+ if (mapping) {
+ if (UtilService.isUndefined(mapping.serveEventListeners)) {
+ mapping.serveEventListeners = [];
+ }
+ mapping.serveEventListeners.push({
+ name: "webhook",
+ parameters: {
+ "method": "POST",
+ "url": "https://localhost",
+ "headers": {
+ "Content-Type": "application/json"
+ },
+ "body": "{}"
+ }
+ });
+ return mapping;
+ }
+
+ return undefined;
+ }
}
diff --git a/webapp/wiremock/src/app/components/mappings/mappings.component.html b/webapp/wiremock/src/app/components/mappings/mappings.component.html
index b94dca74ba..456c1ebacc 100644
--- a/webapp/wiremock/src/app/components/mappings/mappings.component.html
+++ b/webapp/wiremock/src/app/components/mappings/mappings.component.html
@@ -101,6 +101,22 @@
+
+
+
+
+