Skip to content

Commit

Permalink
Merge pull request #2149 from Alonexc/fix_bug_2148
Browse files Browse the repository at this point in the history
[ISSUE #2148] Fix webhook test NPE
close #2148
  • Loading branch information
xwm1992 committed Nov 10, 2022
2 parents c74100a + 7b604af commit 61d90eb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
Expand Up @@ -21,6 +21,7 @@
import org.apache.eventmesh.common.protocol.ProtocolTransportObject;
import org.apache.eventmesh.common.protocol.http.HttpEventWrapper;
import org.apache.eventmesh.common.protocol.http.WebhookProtocolTransportObject;
import org.apache.eventmesh.common.utils.RandomStringUtils;
import org.apache.eventmesh.protocol.api.ProtocolAdaptor;
import org.apache.eventmesh.protocol.api.exception.ProtocolHandleException;

Expand All @@ -47,6 +48,8 @@ public CloudEvent toCloudEvent(WebhookProtocolTransportObject protocol) throws P
.withType(protocol.getEventType())
.withData(protocol.getBody())
.withExtension(Constants.PROTOCOL_TYPE, "webhook")
.withExtension("bizseqno", RandomStringUtils.generateNum(30))
.withExtension("uniqueid", RandomStringUtils.generateNum(30))
.build();
}

Expand Down
Expand Up @@ -54,7 +54,7 @@ public ShowListenClientByTopicHandler(EventMeshTCPServer eventMeshTCPServer) {
@Override
public void handle(HttpExchange httpExchange) throws IOException {
StringBuilder result = new StringBuilder();
try(OutputStream out = httpExchange.getResponseBody();) {
try (OutputStream out = httpExchange.getResponseBody()) {
String queryString = httpExchange.getRequestURI().getQuery();
Map<String, String> queryStringInfo = NetUtils.formData2Dic(queryString);
String topic = queryStringInfo.get(EventMeshConstants.MANAGE_TOPIC);
Expand Down

0 comments on commit 61d90eb

Please sign in to comment.