Beispiel #1
0
 public MemoryResource(MediaType responseType, Stream content)
     : this()
 {
     Operations["HEAD"] = Operations["GET"] = request =>
         new MemoryResponse
         {
             RequestUri = request.RequestUri,
             ResponseUri = request.RequestUri,
             Status = new HttpStatus(200, "OK"),
             Headers =
             {
                     { "Content-Type", responseType.ToString() },
                     { "Content-Length", content.Length.ToString() }
             },
             Entity = new MemoryEntity(responseType, request.Method == "HEAD" ? null : content)
         };
 }
Beispiel #2
0
 public MemoryEntity(MediaType mediaType, Stream memoryStream)
 {
     Stream = memoryStream;
     ContentType = mediaType;
 }
Beispiel #3
0
 public HttpEntity(Stream stream)
 {
     Stream = stream;
     ContentType = new MediaType("application/octet-stream");
 }