Skip to content

Commit

Permalink
Merge pull request #60 from jonnii/virtual-serializer-methods
Browse files Browse the repository at this point in the history
Virtual serialize methods
  • Loading branch information
jonnii authored Nov 20, 2017
2 parents 572d926 + dcdea50 commit 17eb691
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/SpeakEasy/Serializers/DefaultJsonSerializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,17 @@ public DefaultJsonSerializer(JsonSerializer serializer, int serializationBufferS
this.serializationBufferSize = serializationBufferSize;
}

public IEnumerable<string> SupportedMediaTypes => new[]
public virtual IEnumerable<string> SupportedMediaTypes => new[]
{
"application/json",
"text/json",
"text/x-json",
"text/javascript"
};

public string MediaType => SupportedMediaTypes.First();
public virtual string MediaType => SupportedMediaTypes.First();

public Task SerializeAsync<T>(Stream stream, T body, CancellationToken cancellationToken = default(CancellationToken))
public virtual Task SerializeAsync<T>(Stream stream, T body, CancellationToken cancellationToken = default(CancellationToken))
{
using (var streamWriter = new StreamWriter(stream, new System.Text.UTF8Encoding(false), serializationBufferSize, true))
{
Expand All @@ -55,7 +55,7 @@ public DefaultJsonSerializer(JsonSerializer serializer, int serializationBufferS
return okTask;
}

public T Deserialize<T>(Stream body)
public virtual T Deserialize<T>(Stream body)
{
using (var streamReader = new StreamReader(body))
{
Expand All @@ -66,7 +66,7 @@ public T Deserialize<T>(Stream body)
}
}

public object Deserialize(Stream body, Type type)
public virtual object Deserialize(Stream body, Type type)
{
using (var streamReader = new StreamReader(body))
{
Expand Down

0 comments on commit 17eb691

Please sign in to comment.