Skip to content

Commit bf90f55

Browse files
authored
Merge pull request #299 from jamierytlewski/development
fix(http request): Cleared out accept header if a file is returned
2 parents e627b90 + 43413db commit bf90f55

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/IBM.WatsonDeveloperCloud.TextToSpeech.v1/TextToSpeechService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ public Voices ListVoices(Dictionary<string, object> customData = null)
199199
/// that owns the custom model. Omit the parameter to use the specified voice with no customization.
200200
/// (optional)</param>
201201
/// <param name="customData">Custom data object to pass data including custom request headers.</param>
202-
/// <returns><see cref="System.IO.FileStream" />System.IO.FileStream</returns>
202+
/// <returns><see cref="System.IO.MemoryStream" />System.IO.MemoryStream</returns>
203203
public System.IO.MemoryStream Synthesize(Text text, string accept = null, string voice = null, string customizationId = null, Dictionary<string, object> customData = null)
204204
{
205205
if (text == null)

src/IBM.WatsonDeveloperCloud/Http/Request.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,10 @@ public IRequest WithBodyContent(HttpContent body)
8181

8282
public IRequest WithHeader(string key, string value)
8383
{
84+
if (key == "Accept" && value.StartsWith("audio/", StringComparison.OrdinalIgnoreCase))
85+
{
86+
this.Message.Headers.Accept.Clear();
87+
}
8488
this.Message.Headers.TryAddWithoutValidation(key, value);
8589
return this;
8690
}

0 commit comments

Comments
 (0)