Skip to content

Commit 446f29c

Browse files
authored
Update ApiClient.mustache
1 parent f6de5b7 commit 446f29c

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

  • modules/openapi-generator/src/main/resources/csharp/libraries/unityWebRequest

modules/openapi-generator/src/main/resources/csharp/libraries/unityWebRequest/ApiClient.mustache

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,16 @@ namespace {{packageName}}.Client
274274
request = UnityWebRequest.Post(uri, form);
275275
request.method = method;
276276
}
277+
else if (options.Data is Stream stream)
278+
{
279+
using (var binaryReader = new BinaryReader(stream))
280+
{
281+
var bytes = binaryReader.ReadBytes((int)stream.Length);
282+
request = UnityWebRequest.Put(uri, bytes);
283+
request.method = method;
284+
request.SetRequestHeader("Content-Type", "application/octet-stream");
285+
}
286+
}
277287
else if (options.Data != null)
278288
{
279289
var serializer = new CustomJsonCodec(SerializerSettings, configuration);

0 commit comments

Comments
 (0)