Skip to content

Commit

Permalink
handle mp4 like any other media in Embed toMap()
Browse files Browse the repository at this point in the history
  • Loading branch information
CPogX committed Dec 19, 2024
1 parent 132e58c commit a9b438c
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions karate-core/src/main/java/com/intuit/karate/core/Embed.java
Original file line number Diff line number Diff line change
Expand Up @@ -108,15 +108,8 @@ public String getAsHtmlTag() {

public Map toMap() {
Map map = new HashMap(2);
if (resourceType == ResourceType.MP4) {
byte[] bytes = FileUtils.toBytes(getAsHtmlTag());
String base64 = Base64.getEncoder().encodeToString(bytes);
map.put("data", base64);
map.put("mime_type", ResourceType.HTML.contentType);
} else {
map.put("data", getBase64());
map.put("mime_type", resourceType.contentType);
}
map.put("data", getBase64());
map.put("mime_type", resourceType.contentType);
return map;
}

Expand Down

0 comments on commit a9b438c

Please sign in to comment.