{"action":"created","issue":{"url":"https://api.github.com/repos/nickel-org/nickel.rs/issues/347","repository_url":"https://api.github.com/repos/nickel-org/nickel.rs","labels_url":"https://api.github.com/repos/nickel-org/nickel.rs/issues/347/labels{/name}","comments_url":"https://api.github.com/repos/nickel-org/nickel.rs/issues/347/comments","events_url":"https://api.github.com/repos/nickel-org/nickel.rs/issues/347/events","html_url":"https://github.com/nickel-org/nickel.rs/issues/347","id":160972623,"number":347,"title":"Binary example","user":{"login":"maxfridbe","id":2702842,"avatar_url":"https://avatars.githubusercontent.com/u/2702842?v=3","gravatar_id":"","url":"https://api.github.com/users/maxfridbe","html_url":"https://github.com/maxfridbe","followers_url":"https://api.github.com/users/maxfridbe/followers","following_url":"https://api.github.com/users/maxfridbe/following{/other_user}","gists_url":"https://api.github.com/users/maxfridbe/gists{/gist_id}","starred_url":"https://api.github.com/users/maxfridbe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maxfridbe/subscriptions","organizations_url":"https://api.github.com/users/maxfridbe/orgs","repos_url":"https://api.github.com/users/maxfridbe/repos","events_url":"https://api.github.com/users/maxfridbe/events{/privacy}","received_events_url":"https://api.github.com/users/maxfridbe/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2016-06-17T20:51:32Z","updated_at":"2016-06-24T16:52:07Z","closed_at":null,"body":"Would it be possible to have an example of a response of a binary like image/jpeg"},"comment":{"url":"https://api.github.com/repos/nickel-org/nickel.rs/issues/comments/228399263","html_url":"https://github.com/nickel-org/nickel.rs/issues/347#issuecomment-228399263","issue_url":"https://api.github.com/repos/nickel-org/nickel.rs/issues/347","id":228399263,"user":{"login":"maxfridbe","id":2702842,"avatar_url":"https://avatars.githubusercontent.com/u/2702842?v=3","gravatar_id":"","url":"https://api.github.com/users/maxfridbe","html_url":"https://github.com/maxfridbe","followers_url":"https://api.github.com/users/maxfridbe/followers","following_url":"https://api.github.com/users/maxfridbe/following{/other_user}","gists_url":"https://api.github.com/users/maxfridbe/gists{/gist_id}","starred_url":"https://api.github.com/users/maxfridbe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maxfridbe/subscriptions","organizations_url":"https://api.github.com/users/maxfridbe/orgs","repos_url":"https://api.github.com/users/maxfridbe/repos","events_url":"https://api.github.com/users/maxfridbe/events{/privacy}","received_events_url":"https://api.github.com/users/maxfridbe/received_events","type":"User","site_admin":false},"created_at":"2016-06-24T16:52:07Z","updated_at":"2016-06-24T16:52:07Z","body":"Thank you I was able to return an image via this code:\r\n\r\n```rust\r\nfn handler<'a, D>(_: &mut Request<D>, res: Response<'a, D>) -> MiddlewareResult<'a, D> {\r\n     let p = Path::new(\"test.png\");\r\n     res.send_file(&p)\r\n }\r\n```\r\n\r\nIf i could ask one more question or request one more example.  How do i perform a file upload akin to:\r\n\r\n```c#\r\n[HttpPost, Route(\"api/upload\")]\r\npublic async Task<IHttpActionResult> Upload()\r\n{\r\n    if (!Request.Content.IsMimeMultipartContent())\r\n        throw new HttpResponseException(HttpStatusCode.UnsupportedMediaType); \r\n\r\n    var provider = new MultipartMemoryStreamProvider();\r\n    await Request.Content.ReadAsMultipartAsync(provider);\r\n    foreach (var file in provider.Contents)\r\n    {\r\n        var filename = file.Headers.ContentDisposition.FileName.Trim('\\\"');\r\n        var buffer = await file.ReadAsByteArrayAsync();\r\n        //Do whatever you want with filename and its binaray data.\r\n    }\r\n\r\n    return Ok();\r\n}\r\n\r\n```"}}
{"actor":{"display_login":"maxfridbe"}}