Skip to content

Commit

Permalink
Use minimum of the number of bytes or 128 (#259)
Browse files Browse the repository at this point in the history
Thank you @johnmurphy01 for the fix.
  • Loading branch information
johnmurphy01 authored and royjit committed Aug 6, 2019
1 parent 72e36f4 commit 0fa8d87
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion AWSAppSyncClient/AWSAppSyncSubscriptionWatcher.swift
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ public final class AWSAppSyncSubscriptionWatcher<Subscription: GraphQLSubscripti
func messageCallbackDelegate(data: Data) {
do {
AppSyncLog.debug("Received message")
AppSyncLog.verbose("First 128 bytes of message data is [\(data.prefix(upTo: 128))]")
AppSyncLog.verbose("First \(min(data.count, 128)) bytes of message data is [\(data.prefix(upTo: min(data.count, 128)))]")

guard String(data: data, encoding: .utf8) != nil else {
let error = AWSAppSyncSubscriptionError.messageCallbackError("Unable to convert message data to String using UTF8 encoding")
Expand Down

0 comments on commit 0fa8d87

Please sign in to comment.