Skip to content

Commit

Permalink
fix CI error: protocol http
Browse files Browse the repository at this point in the history
  • Loading branch information
horoc committed Nov 3, 2022
1 parent 1618f4a commit 4faf810
Showing 1 changed file with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,11 @@

package org.apache.eventmesh.protocol.http;

import com.fasterxml.jackson.core.type.TypeReference;
import io.cloudevents.CloudEvent;
import static org.apache.eventmesh.protocol.http.HttpProtocolConstant.CONSTANTS_KEY_BODY;
import static org.apache.eventmesh.protocol.http.HttpProtocolConstant.CONSTANTS_KEY_HEADERS;
import static org.apache.eventmesh.protocol.http.HttpProtocolConstant.CONSTANTS_KEY_METHOD;
import static org.apache.eventmesh.protocol.http.HttpProtocolConstant.CONSTANTS_KEY_PATH;

import org.apache.eventmesh.common.Constants;
import org.apache.eventmesh.common.protocol.ProtocolTransportObject;
import org.apache.eventmesh.common.protocol.http.HttpEventWrapper;
Expand All @@ -34,7 +37,10 @@
import java.util.Map;
import java.util.Set;

import static org.apache.eventmesh.protocol.http.HttpProtocolConstant.*;
import io.cloudevents.CloudEvent;

import com.fasterxml.jackson.core.type.TypeReference;


/**
* CloudEvents protocol adaptor, used to transform CloudEvents message to CloudEvents message.
Expand Down Expand Up @@ -92,8 +98,8 @@ public ProtocolTransportObject fromCloudEvent(CloudEvent cloudEvent) throws Prot
// ce data
if (null != cloudEvent.getData()) {
Map<String, Object> dataContentMap = JsonUtils.deserialize(new String(cloudEvent.getData().toBytes(), Constants.DEFAULT_CHARSET),
new TypeReference<Map<String, Object>>() {
});
new TypeReference<Map<String, Object>>() {
});
String requestHeader = JsonUtils.serialize(dataContentMap.get(CONSTANTS_KEY_HEADERS));
byte[] requestBody = JsonUtils.serialize(dataContentMap.get(CONSTANTS_KEY_BODY)).getBytes(StandardCharsets.UTF_8);
Map<String, Object> requestHeaderMap = JsonUtils.deserialize(requestHeader, new TypeReference<Map<String, Object>>() {
Expand Down

0 comments on commit 4faf810

Please sign in to comment.