Skip to content

Commit

Permalink
add microsoft vendor-specific content types to be excluded by default (
Browse files Browse the repository at this point in the history
  • Loading branch information
sokomishalov committed Dec 9, 2021
1 parent abd65f2 commit 19d56eb
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions logbook-core/src/main/java/org/zalando/logbook/BodyReplacers.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,18 @@ public static <T extends HttpMessage> BodyReplacer<T> defaultValue() {
@API(status = MAINTAINED)
public static <T extends HttpMessage> BodyReplacer<T> binary() {
final Predicate<T> contentTypes = contentType(
"application/octet-stream", "application/pdf", "audio/*", "image/*", "video/*");
"application/octet-stream",
"application/pdf", // Adobe Portable Document Format (PDF)
"application/vnd.ms-excel", // Microsoft Excel
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", // Microsoft Excel (OpenXML)
"application/msword", // Microsoft Word
"application/vnd.openxmlformats-officedocument.wordprocessingml.document", // Microsoft Word (OpenXML)
"application/vnd.ms-powerpoint", // Microsoft PowerPoint
"application/vnd.openxmlformats-officedocument.presentationml.presentation", // Microsoft PowerPoint (OpenXML)
"audio/*", // Audio
"image/*", // Image
"video/*" // Video
);
return replaceBody(contentTypes, "<binary>");
}

Expand All @@ -38,7 +49,8 @@ public static <T extends HttpMessage> BodyReplacer<T> stream() {
"application/json-seq", // https://tools.ietf.org/html/rfc7464
"application/x-json-stream", // https://en.wikipedia.org/wiki/JSON_Streaming#Line_delimited_JSON
"application/stream+json", // https://tools.ietf.org/html/draft-snell-activity-streams-type-01
"text/event-stream" // https://tools.ietf.org/html/rfc6202
"text/event-stream", // https://tools.ietf.org/html/rfc6202
"application/x-ndjson" // https://ndjson.org
);
return replaceBody(contentTypes, "<stream>");
}
Expand Down

0 comments on commit 19d56eb

Please sign in to comment.