{"action":"opened","issue":{"url":"https://api.github.com/repos/stormtea123/stormtea123.github.com/issues/5","repository_url":"https://api.github.com/repos/stormtea123/stormtea123.github.com","labels_url":"https://api.github.com/repos/stormtea123/stormtea123.github.com/issues/5/labels{/name}","comments_url":"https://api.github.com/repos/stormtea123/stormtea123.github.com/issues/5/comments","events_url":"https://api.github.com/repos/stormtea123/stormtea123.github.com/issues/5/events","html_url":"https://github.com/stormtea123/stormtea123.github.com/issues/5","id":137179500,"number":5,"title":"FormData","user":{"login":"stormtea123","id":1193966,"avatar_url":"https://avatars.githubusercontent.com/u/1193966?v=3","gravatar_id":"","url":"https://api.github.com/users/stormtea123","html_url":"https://github.com/stormtea123","followers_url":"https://api.github.com/users/stormtea123/followers","following_url":"https://api.github.com/users/stormtea123/following{/other_user}","gists_url":"https://api.github.com/users/stormtea123/gists{/gist_id}","starred_url":"https://api.github.com/users/stormtea123/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stormtea123/subscriptions","organizations_url":"https://api.github.com/users/stormtea123/orgs","repos_url":"https://api.github.com/users/stormtea123/repos","events_url":"https://api.github.com/users/stormtea123/events{/privacy}","received_events_url":"https://api.github.com/users/stormtea123/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-02-29T08:04:30Z","updated_at":"2016-02-29T08:04:30Z","closed_at":null,"body":"```js\r\n(function(w) {\r\n    if (w.FormData)\r\n        return;\r\n    function FormData() {\r\n        this.fake = true;\r\n        this.boundary = \"--------FormData\" + Math.random();\r\n        this._fields = [];\r\n    }\r\n    FormData.prototype.append = function(key, value) {\r\n        this._fields.push([key, value]);\r\n    }\r\n    FormData.prototype.toString = function() {\r\n        var boundary = this.boundary;\r\n        var body = \"\";\r\n        this._fields.forEach(function(field) {\r\n            body += \"--\" + boundary + \"\\r\\n\";\r\n            // file upload\r\n            if (field[1].name) {\r\n                var file = field[1];\r\n                body += \"Content-Disposition: form-data; name=\\\"\"+ field[0] +\"\\\"; filename=\\\"\"+ file.name +\"\\\"\\r\\n\";\r\n                body += \"Content-Type: \"+ file.type +\"\\r\\n\\r\\n\";\r\n                body += file.getAsBinary() + \"\\r\\n\";\r\n            } else {\r\n                body += \"Content-Disposition: form-data; name=\\\"\"+ field[0] +\"\\\";\\r\\n\\r\\n\";\r\n                body += field[1] + \"\\r\\n\";\r\n            }\r\n        });\r\n        body += \"--\" + boundary +\"--\";\r\n        return body;\r\n    }\r\n    w.FormData = FormData;\r\n})(window);\r\n```"}}