{"action":"created","issue":{"url":"https://api.github.com/repos/vert-x3/vertx-web/issues/1133","repository_url":"https://api.github.com/repos/vert-x3/vertx-web","labels_url":"https://api.github.com/repos/vert-x3/vertx-web/issues/1133/labels{/name}","comments_url":"https://api.github.com/repos/vert-x3/vertx-web/issues/1133/comments","events_url":"https://api.github.com/repos/vert-x3/vertx-web/issues/1133/events","html_url":"https://github.com/vert-x3/vertx-web/issues/1133","id":397452280,"node_id":"MDU6SXNzdWUzOTc0NTIyODA=","number":1133,"title":"Exception occurs with getBodyAsJson() method when empty body","user":{"login":"aygalinc","id":4963050,"node_id":"MDQ6VXNlcjQ5NjMwNTA=","avatar_url":"https://avatars1.githubusercontent.com/u/4963050?v=4","gravatar_id":"","url":"https://api.github.com/users/aygalinc","html_url":"https://github.com/aygalinc","followers_url":"https://api.github.com/users/aygalinc/followers","following_url":"https://api.github.com/users/aygalinc/following{/other_user}","gists_url":"https://api.github.com/users/aygalinc/gists{/gist_id}","starred_url":"https://api.github.com/users/aygalinc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aygalinc/subscriptions","organizations_url":"https://api.github.com/users/aygalinc/orgs","repos_url":"https://api.github.com/users/aygalinc/repos","events_url":"https://api.github.com/users/aygalinc/events{/privacy}","received_events_url":"https://api.github.com/users/aygalinc/received_events","type":"User","site_admin":false},"labels":[{"id":147749639,"node_id":"MDU6TGFiZWwxNDc3NDk2Mzk=","url":"https://api.github.com/repos/vert-x3/vertx-web/labels/bug","name":"bug","color":"fc2929","default":true}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/vert-x3/vertx-web/milestones/16","html_url":"https://github.com/vert-x3/vertx-web/milestone/16","labels_url":"https://api.github.com/repos/vert-x3/vertx-web/milestones/16/labels","id":4015117,"node_id":"MDk6TWlsZXN0b25lNDAxNTExNw==","number":16,"title":"3.7.0","description":null,"creator":{"login":"pmlopes","id":849467,"node_id":"MDQ6VXNlcjg0OTQ2Nw==","avatar_url":"https://avatars2.githubusercontent.com/u/849467?v=4","gravatar_id":"","url":"https://api.github.com/users/pmlopes","html_url":"https://github.com/pmlopes","followers_url":"https://api.github.com/users/pmlopes/followers","following_url":"https://api.github.com/users/pmlopes/following{/other_user}","gists_url":"https://api.github.com/users/pmlopes/gists{/gist_id}","starred_url":"https://api.github.com/users/pmlopes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pmlopes/subscriptions","organizations_url":"https://api.github.com/users/pmlopes/orgs","repos_url":"https://api.github.com/users/pmlopes/repos","events_url":"https://api.github.com/users/pmlopes/events{/privacy}","received_events_url":"https://api.github.com/users/pmlopes/received_events","type":"User","site_admin":false},"open_issues":0,"closed_issues":26,"state":"closed","created_at":"2019-01-30T13:41:32Z","updated_at":"2019-11-06T11:02:14Z","due_on":null,"closed_at":"2019-03-30T09:52:11Z"},"comments":9,"created_at":"2019-01-09T16:31:58Z","updated_at":"2019-11-06T11:02:14Z","closed_at":"2019-11-06T11:02:13Z","author_association":"NONE","body":"_### Version\r\n\r\n* vert.x core: 3.6.2\r\n* vert.x web:3.6.2\r\n\r\n### Context\r\n\r\nI encountered an exception which looks suspicious while i received an http request with an empty body and I tried to access it with the  io.vertx.reactivex.ext.web.RoutingContext.getBodyAsJson() method. I expected a JsonObject null or an Empty JsonObject but it seems to fire an exception. (see extra)  \r\n\r\nWith a not empty body, all work fine.\r\nIn case of empty body , getBodyAsString return a null string but no exception is fired. \r\n\r\n### Do you have a reproducer?\r\n\r\n### Steps to reproduce\r\n\r\n1. register a route as following : \r\n' router.get(OBJECT_PATH).handler(BodyHandler.create());\r\n        router.put(OBJECT_PATH)\r\n                .consumes(\"application/json\")\r\n                .handler(this::handleWriteRequest); '\r\n\r\n2. do a context.getBodyAsJson() inside a put handler  (do not forget to add a BodyHandler to the route)\r\n3. Send a request (with curl as example : curl -X PUT -H 'Content-Type: application/json' -i 'http://localhost:8282/handlerAdress')\r\n\r\n### Extra\r\n\r\nException stackTrace : \r\n\r\n[2019-01-09 16:59:22] [LE PLUS PRÉCIS] Failing the routing  \r\n[INFO] [2019-01-09 16:59:22] [GRAVE  ] Unexpected exception in route \r\n[INFO] io.vertx.core.json.DecodeException: Failed to decode:No content to map due to end-of-input\r\n[INFO]  at [Source: (io.netty.buffer.ByteBufInputStream); line: 1, column: 0]\r\n[INFO] \tat io.vertx.core.json.Json.decodeValue(Json.java:172)\r\n[INFO] \tat io.vertx.core.json.JsonObject.fromBuffer(JsonObject.java:960)\r\n[INFO] \tat io.vertx.core.json.JsonObject.<init>(JsonObject.java:73)\r\n[INFO] \tat io.vertx.ext.web.impl.RoutingContextImpl.getBodyAsJson(RoutingContextImpl.java:263)\r\n[INFO] \tat io.vertx.reactivex.ext.web.RoutingContext.getBodyAsJson(RoutingContext.java:309)_\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/vert-x3/vertx-web/issues/comments/550260349","html_url":"https://github.com/vert-x3/vertx-web/issues/1133#issuecomment-550260349","issue_url":"https://api.github.com/repos/vert-x3/vertx-web/issues/1133","id":550260349,"node_id":"MDEyOklzc3VlQ29tbWVudDU1MDI2MDM0OQ==","user":{"login":"pmlopes","id":849467,"node_id":"MDQ6VXNlcjg0OTQ2Nw==","avatar_url":"https://avatars2.githubusercontent.com/u/849467?v=4","gravatar_id":"","url":"https://api.github.com/users/pmlopes","html_url":"https://github.com/pmlopes","followers_url":"https://api.github.com/users/pmlopes/followers","following_url":"https://api.github.com/users/pmlopes/following{/other_user}","gists_url":"https://api.github.com/users/pmlopes/gists{/gist_id}","starred_url":"https://api.github.com/users/pmlopes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pmlopes/subscriptions","organizations_url":"https://api.github.com/users/pmlopes/orgs","repos_url":"https://api.github.com/users/pmlopes/repos","events_url":"https://api.github.com/users/pmlopes/events{/privacy}","received_events_url":"https://api.github.com/users/pmlopes/received_events","type":"User","site_admin":false},"created_at":"2019-11-06T11:02:13Z","updated_at":"2019-11-06T11:02:13Z","author_association":"MEMBER","body":"The fix has been backported to 3.8 branch (will be available on the next 3.8 release)"}}
{"actor":{"display_login":"pmlopes"}}