{"action":"created","issue":{"url":"https://api.github.com/repos/vaadin/vaadin-upload/issues/113","repository_url":"https://api.github.com/repos/vaadin/vaadin-upload","labels_url":"https://api.github.com/repos/vaadin/vaadin-upload/issues/113/labels{/name}","comments_url":"https://api.github.com/repos/vaadin/vaadin-upload/issues/113/comments","events_url":"https://api.github.com/repos/vaadin/vaadin-upload/issues/113/events","html_url":"https://github.com/vaadin/vaadin-upload/pull/113","id":160405767,"number":113,"title":"Allow manual `xhr.send(...)` when the `upload-request` event is prevented","user":{"login":"platosha","id":247998,"avatar_url":"https://avatars.githubusercontent.com/u/247998?v=3","gravatar_id":"","url":"https://api.github.com/users/platosha","html_url":"https://github.com/platosha","followers_url":"https://api.github.com/users/platosha/followers","following_url":"https://api.github.com/users/platosha/following{/other_user}","gists_url":"https://api.github.com/users/platosha/gists{/gist_id}","starred_url":"https://api.github.com/users/platosha/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/platosha/subscriptions","organizations_url":"https://api.github.com/users/platosha/orgs","repos_url":"https://api.github.com/users/platosha/repos","events_url":"https://api.github.com/users/platosha/events{/privacy}","received_events_url":"https://api.github.com/users/platosha/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/vaadin/vaadin-upload/labels/in%20review","name":"in review","color":"ededed"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-06-15T12:05:39Z","updated_at":"2016-06-20T11:46:37Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/vaadin/vaadin-upload/pulls/113","html_url":"https://github.com/vaadin/vaadin-upload/pull/113","diff_url":"https://github.com/vaadin/vaadin-upload/pull/113.diff","patch_url":"https://github.com/vaadin/vaadin-upload/pull/113.patch"},"body":"Resolves #96 without the API changes.\r\n\r\nWhen the `upload-request` event is prevented, the `xhr.send(formData)` is not called in the upload. At the same time, a couple of state file properties are not updated in this case. Therefore, it's hard to send the xhr manually.\r\n\r\nThis PR allows developers to call `xhr.send(whatever)` manually in the `upload-request` event listener, while preventing the default send call. This also makes it possible to send files directly without a FormData wrapper, as well as allows custom data wrappers/encodings.\n\n<!-- Reviewable:start -->\n---\nThis change is [<img src=\"https://reviewable.io/review_button.svg\" height=\"35\" align=\"absmiddle\" alt=\"Reviewable\"/>](https://reviewable.io/reviews/vaadin/vaadin-upload/113)\n<!-- Reviewable:end -->\n"},"comment":{"url":"https://api.github.com/repos/vaadin/vaadin-upload/issues/comments/227120576","html_url":"https://github.com/vaadin/vaadin-upload/pull/113#issuecomment-227120576","issue_url":"https://api.github.com/repos/vaadin/vaadin-upload/issues/113","id":227120576,"user":{"login":"tomivirkki","id":1222264,"avatar_url":"https://avatars.githubusercontent.com/u/1222264?v=3","gravatar_id":"","url":"https://api.github.com/users/tomivirkki","html_url":"https://github.com/tomivirkki","followers_url":"https://api.github.com/users/tomivirkki/followers","following_url":"https://api.github.com/users/tomivirkki/following{/other_user}","gists_url":"https://api.github.com/users/tomivirkki/gists{/gist_id}","starred_url":"https://api.github.com/users/tomivirkki/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tomivirkki/subscriptions","organizations_url":"https://api.github.com/users/tomivirkki/orgs","repos_url":"https://api.github.com/users/tomivirkki/repos","events_url":"https://api.github.com/users/tomivirkki/events{/privacy}","received_events_url":"https://api.github.com/users/tomivirkki/received_events","type":"User","site_admin":false},"created_at":"2016-06-20T11:46:37Z","updated_at":"2016-06-20T11:46:37Z","body":"\n\n\n\nReview status: 0 of 5 files reviewed at latest revision, 4 unresolved discussions, some commit checks failed.\n\n---\n\n*[vaadin-upload.html, line 677 \\[r1\\]](https://reviewable.io:443/reviews/vaadin/vaadin-upload/113#-KKNAVeRtuxh5ruoDIHq:-KKhb-zA-kwnukpiGAaL:-323065025) ([raw file](https://github.com/vaadin/vaadin-upload/blob/d9d2e8a79146b89635c0314fb114fdbe53212a4d/vaadin-upload.html#L677)):*\n<details><summary><i>Previously, platosha (Anton Platonov) wrote…</i></summary>\n> In your example there're two consecutive events, which doesn't make a lot sense.\n> \n> Also, `'upload-start'` by doc is fired after the request is sent.\n> \n> IMO, not interrupting the flow after preventing `upload-request` is OK. At the point when `upload-request` is fired, the uploading request is already open, so the uploading has already started, the connection has opened. The only thing you can prevent here is the default request send, you can’t cancel the uploading overall.\n</details>\nPreventing the default makes it possible to trigger the send asynchronously, right? Then `'upload-start'` would get fired before the request is actually sent.\n\nWould make more sense to stop the workflow on preventDefault in that case.\n\n---\n\n*[docs/vaadin-upload-basic.adoc, line 113 \\[r2\\]](https://reviewable.io:443/reviews/vaadin/vaadin-upload/113#-KKhZ5zZnY8rWjkC2EcR:-KKhZ5zZnY8rWjkC2EcS:-360068415) ([raw file](https://github.com/vaadin/vaadin-upload/blob/2bc2095df5f1e1c23eeaaa3312367485ada60f67/docs/vaadin-upload-basic.adoc#L113)):*\n> ```AsciiDoc\n> `upload-progress`:: Fired as many times as a file progress is updated.\n> `upload-request`:: Fired when the request has been opened but not yet sent. It is useful for appending additional data keys to the request and for changing some parameters such as headers.\n>   If the event is default-prevented, then the request is not sent to the server. In this case, you can send XHR manually.\n> ```\n\n...send the (related?) XHR...\n\n---\n\n*[docs/vaadin-upload-server.adoc, line 68 \\[r2\\]](https://reviewable.io:443/reviews/vaadin/vaadin-upload/113#-KKhZGBzvjzx6u1lNnpv:-KKhZGBzvjzx6u1lNnpw:1440347766) ([raw file](https://github.com/vaadin/vaadin-upload/blob/2bc2095df5f1e1c23eeaaa3312367485ada60f67/docs/vaadin-upload-server.adoc#L68)):*\n> ```AsciiDoc\n> ----\n> \n> `upload-request`:: You can change request parameters before it is sent, append data keys to the request.\n> ```\n\n...sent or append...\n\n---\n\n\n*Comments from [Reviewable](https://reviewable.io:443/reviews/vaadin/vaadin-upload/113)*\n<!-- Sent from Reviewable.io -->\n"}}
{"actor":{"display_login":"tomivirkki"}}