File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
modules/openapi-generator/src/main/resources/csharp/libraries/unityWebRequest Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -274,6 +274,23 @@ namespace {{packageName}}.Client
274
274
request = UnityWebRequest.Post(uri, form);
275
275
request.method = method;
276
276
}
277
+ else if (contentType == "application/octet-stream")
278
+ {
279
+ if (options.Data is Stream stream)
280
+ {
281
+ using (var binaryReader = new BinaryReader(stream))
282
+ {
283
+ var bytes = binaryReader.ReadBytes((int)stream.Length);
284
+ request = UnityWebRequest.Put(uri, bytes);
285
+ request.method = method;
286
+ request.SetRequestHeader(" Content-Type" , " application/octet-stream" );
287
+ }
288
+ }
289
+ else
290
+ {
291
+ throw new InvalidDataException($" {nameof(options.Data)} is not of {nameof(Stream)} type" );
292
+ }
293
+ }
277
294
else if (options.Data != null)
278
295
{
279
296
var serializer = new CustomJsonCodec(SerializerSettings, configuration);
You can’t perform that action at this time.
0 commit comments