Skip to content

Commit 5234cde

Browse files
committed
Add requestBody method to BaseHttpEventBuilder
Introduces a requestBody method to BaseHttpEvent.BaseHttpEventBuilder, allowing the setting or updating of the BodyPayload with a JsonNode. This enhances the builder's ability to handle request body data.
1 parent 2e48b3c commit 5234cde

File tree

1 file changed

+9
-0
lines changed
  • spring-web-captor/src/main/java/com/davidrandoll/spring_web_captor/event

1 file changed

+9
-0
lines changed

spring-web-captor/src/main/java/com/davidrandoll/spring_web_captor/event/BaseHttpEvent.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ public MultiValueMap<String, MultipartFile> getRequestFiles() {
8282
public static abstract class BaseHttpEventBuilder<C extends BaseHttpEvent, B extends BaseHttpEventBuilder<C, B>> {
8383
protected Map<String, Object> additionalData$value = new HashMap<>();
8484
private boolean additionalData$set;
85+
protected BodyPayload bodyPayload;
8586

8687
public B additionalData(String key, Object value) {
8788
this.additionalData$set = true;
@@ -94,5 +95,13 @@ public B additionalData(Map<String, Object> values) {
9495
this.additionalData$value.putAll(values);
9596
return self();
9697
}
98+
99+
public B requestBody(JsonNode body) {
100+
if (bodyPayload == null)
101+
bodyPayload = new BodyPayload(body);
102+
else
103+
bodyPayload.setBody(body);
104+
return self();
105+
}
97106
}
98107
}

0 commit comments

Comments
 (0)