{"action":"created","issue":{"url":"https://api.github.com/repos/me-no-dev/ESPAsyncWebServer/issues/190","repository_url":"https://api.github.com/repos/me-no-dev/ESPAsyncWebServer","labels_url":"https://api.github.com/repos/me-no-dev/ESPAsyncWebServer/issues/190/labels{/name}","comments_url":"https://api.github.com/repos/me-no-dev/ESPAsyncWebServer/issues/190/comments","events_url":"https://api.github.com/repos/me-no-dev/ESPAsyncWebServer/issues/190/events","html_url":"https://github.com/me-no-dev/ESPAsyncWebServer/issues/190","id":244903905,"number":190,"title":"Document how to use handleUpload and handleBody depending on what client sends","user":{"login":"probonopd","id":2480569,"avatar_url":"https://avatars3.githubusercontent.com/u/2480569?v=4","gravatar_id":"","url":"https://api.github.com/users/probonopd","html_url":"https://github.com/probonopd","followers_url":"https://api.github.com/users/probonopd/followers","following_url":"https://api.github.com/users/probonopd/following{/other_user}","gists_url":"https://api.github.com/users/probonopd/gists{/gist_id}","starred_url":"https://api.github.com/users/probonopd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/probonopd/subscriptions","organizations_url":"https://api.github.com/users/probonopd/orgs","repos_url":"https://api.github.com/users/probonopd/repos","events_url":"https://api.github.com/users/probonopd/events{/privacy}","received_events_url":"https://api.github.com/users/probonopd/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2017-07-23T11:18:25Z","updated_at":"2017-07-23T15:06:52Z","closed_at":"2017-07-23T15:06:52Z","body":"__EDIT: This may be of lesser priority if https://github.com/me-no-dev/ESPAsyncWebServer/issues/191 can be solved.__\r\n\r\nAssume I have an API endpoint `/api/files/local` that can be called with or without FILE.\r\n\r\nThe documentation says:\r\n```\r\n//Check if POST (but not File) parameter exists\r\nif(request->hasParam(\"download\", true))\r\n  AsyncWebParameter* p = request->getParam(\"download\", true);\r\n\r\n//Check if FILE was uploaded\r\nif(request->hasParam(\"download\", true, true))\r\n  AsyncWebParameter* p = request->getParam(\"download\", true, true);\r\n```\r\n\r\nBut the documentation does not say how to handle these two cases.\r\n\r\nConsider this code:\r\n\r\n```\r\n  server.on(\"/api/files/local\", HTTP_POST, [](AsyncWebServerRequest * request) {\r\n    if(!request->hasParam(\"file\", true, true)){\r\n      // Need handleBody?\r\n      // To call handleBody instead of handleUpload, we need a filter since we can only hardwire one handler to server.on. How to do this?\r\n    }\r\n    request->send(200, \"application/json\", \"{}\");\r\n  }, handleUpload);\r\n```\r\n\r\nHow can I make the upload work with `handleUpload` or `handleBody` depending on what the client sends?"},"comment":{"url":"https://api.github.com/repos/me-no-dev/ESPAsyncWebServer/issues/comments/317259565","html_url":"https://github.com/me-no-dev/ESPAsyncWebServer/issues/190#issuecomment-317259565","issue_url":"https://api.github.com/repos/me-no-dev/ESPAsyncWebServer/issues/190","id":317259565,"user":{"login":"probonopd","id":2480569,"avatar_url":"https://avatars3.githubusercontent.com/u/2480569?v=4","gravatar_id":"","url":"https://api.github.com/users/probonopd","html_url":"https://github.com/probonopd","followers_url":"https://api.github.com/users/probonopd/followers","following_url":"https://api.github.com/users/probonopd/following{/other_user}","gists_url":"https://api.github.com/users/probonopd/gists{/gist_id}","starred_url":"https://api.github.com/users/probonopd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/probonopd/subscriptions","organizations_url":"https://api.github.com/users/probonopd/orgs","repos_url":"https://api.github.com/users/probonopd/repos","events_url":"https://api.github.com/users/probonopd/events{/privacy}","received_events_url":"https://api.github.com/users/probonopd/received_events","type":"User","site_admin":false},"created_at":"2017-07-23T15:06:52Z","updated_at":"2017-07-23T15:06:52Z","body":"Closing because https://github.com/me-no-dev/ESPAsyncWebServer/issues/191 addresses my needs. Turns out I don't need `handleBody`."}}
{"actor":{"display_login":"probonopd"}}