Skip to content

Commit

Permalink
collect garbage of source code.
Browse files Browse the repository at this point in the history
  • Loading branch information
jsakamoto committed Sep 1, 2014
1 parent 8349566 commit 3604e77
Showing 1 changed file with 3 additions and 13 deletions.
16 changes: 3 additions & 13 deletions VoiceTextWebAPI.Client/VoiceTextClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,28 +49,18 @@ public byte[] GetVoice(string text)
return bytes;
}

//public async Task<byte[]> GetVoiceAsync(string text)
//{
// var httpClinet = CreateHttpClient();
// var content = BuildHttpRequestContent(text);
// var response = await httpClinet.PostAsync(this.APIEndPoint, content);
// if (response.StatusCode != HttpStatusCode.OK) ThrowVoiceTextException(response);
// var bytes = await response.Content.ReadAsByteArrayAsync();
// return bytes;
//}

public Task<byte[]> GetVoiceAsync(string text)
{
var httpClinet = CreateHttpClient();
var content = BuildHttpRequestContent(text);
var x = httpClinet.PostAsync(this.APIEndPoint, content)
return httpClinet.PostAsync(this.APIEndPoint, content)
.ContinueWith(t =>
{
var response = t.Result;
if (response.StatusCode != HttpStatusCode.OK) ThrowVoiceTextException(response);
return response.Content.ReadAsByteArrayAsync();
});
return x.Unwrap();
})
.Unwrap();
}

private HttpClient CreateHttpClient()
Expand Down

0 comments on commit 3604e77

Please sign in to comment.