I have a PATCH
method in an REST MVC controller implemented in C# that I need to be able to call. The body of the PATCH
request is an object (received as JSON) where most properties are standard types but one (which is a file) is of type Stream
.
Like this:
public class MyDTO{ public string SomeProperty { get; set; } public Stream SomeFile { get; set; }}
When running this service the Swagger UI exposes SomeFile
as a string in the example JSON it generates.
When I am writing a client for this I assign values to these properties, I can assign a Stream
value to SomeFile
generated from an actual file from the filesystem. However when I try to run this I get the error
Timeouts are not supported on this stream
I have tried copying the FileStream
to an in memory stream but this has the same problem.
How do I assign a value to this property to call the service?