Skip to content

Commit 9263f72

Browse files
authored
feat: always reset stream position after call to serializer (#235)
* feat: always reset stream position after call to serializer * docs: remove setting stream position from custom serializer sample
1 parent a153aea commit 9263f72

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,6 @@ public class NewtonsoftJson7Serializer : IJsonSerializer
533533
Serializer.Serialize(jsonWriter, instance);
534534

535535
jsonWriter.Flush();
536-
stream.Position = 0;
537536
}
538537
}
539538

src/Unleash/Communication/UnleashApiClient.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ public async Task<bool> RegisterClient(ClientRegistration registration, Cancella
187187

188188
var memoryStream = new MemoryStream();
189189
jsonSerializer.Serialize(memoryStream, registration);
190+
memoryStream.Position = 0;
190191

191192
const int bufferSize = 1024 * 4;
192193

@@ -233,6 +234,7 @@ public async Task<bool> SendMetrics(ThreadSafeMetricsBucket metrics, Cancellatio
233234
InstanceId = clientRequestHeaders.InstanceTag,
234235
Bucket = bucket
235236
});
237+
memoryStream.Position = 0;
236238
}
237239

238240
const int bufferSize = 1024 * 4;

0 commit comments

Comments
 (0)