Skip to content

Commit f34b6fd

Browse files
committed
fix: Assume plain text when MIME type is not specified
1 parent 865b288 commit f34b6fd

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Sources/GoodNetworking/Logging/DataTaskLogging.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ internal extension DataTaskProxy {
2323
\(prepareHeaders(request: task.originalRequest))
2424
2525
📤 Request body:
26-
\(prettyPrintMessage(data: task.originalRequest?.httpBody, mimeType: "json" /*We always encode to JSON*/))
26+
\(prettyPrintMessage(data: task.originalRequest?.httpBody))
2727
2828
📦 Received data:
2929
\(prettyPrintMessage(data: receivedData, mimeType: task.response?.mimeType))
@@ -53,7 +53,7 @@ internal extension DataTaskProxy {
5353
.joined(separator: "\n")
5454
}
5555

56-
@NetworkActor private func prettyPrintMessage(data: Data?, mimeType: String?) -> String {
56+
@NetworkActor private func prettyPrintMessage(data: Data?, mimeType: String? = "text/plain") -> String {
5757
guard let data else { return "" }
5858
guard plainTextMimeTypeHeuristic(mimeType) else { return "🏞️ Detected MIME type is not plain text" }
5959
guard data.count < Self.maxLogSizeBytes else {

0 commit comments

Comments
 (0)