{"action":"created","issue":{"url":"https://api.github.com/repos/SergioBenitez/Rocket/issues/731","repository_url":"https://api.github.com/repos/SergioBenitez/Rocket","labels_url":"https://api.github.com/repos/SergioBenitez/Rocket/issues/731/labels{/name}","comments_url":"https://api.github.com/repos/SergioBenitez/Rocket/issues/731/comments","events_url":"https://api.github.com/repos/SergioBenitez/Rocket/issues/731/events","html_url":"https://github.com/SergioBenitez/Rocket/issues/731","id":349349440,"node_id":"MDU6SXNzdWUzNDkzNDk0NDA=","number":731,"title":"GET should support payloads","user":{"login":"kitsuneninetails","id":9975355,"node_id":"MDQ6VXNlcjk5NzUzNTU=","avatar_url":"https://avatars3.githubusercontent.com/u/9975355?v=4","gravatar_id":"","url":"https://api.github.com/users/kitsuneninetails","html_url":"https://github.com/kitsuneninetails","followers_url":"https://api.github.com/users/kitsuneninetails/followers","following_url":"https://api.github.com/users/kitsuneninetails/following{/other_user}","gists_url":"https://api.github.com/users/kitsuneninetails/gists{/gist_id}","starred_url":"https://api.github.com/users/kitsuneninetails/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kitsuneninetails/subscriptions","organizations_url":"https://api.github.com/users/kitsuneninetails/orgs","repos_url":"https://api.github.com/users/kitsuneninetails/repos","events_url":"https://api.github.com/users/kitsuneninetails/events{/privacy}","received_events_url":"https://api.github.com/users/kitsuneninetails/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-08-10T01:57:12Z","updated_at":"2018-08-10T03:04:36Z","closed_at":null,"author_association":"NONE","body":"Currently, when trying to specify a `data` field for a GET route:\r\n\r\n```\r\n    #[get(\"/testGetBody\", data=\"<data>\", )]\r\n    fn test_get_body(data: String) -> String {\r\n        format!(\"{}-SUCCESS\", data)\r\n    }\r\n```\r\n\r\nThis error is generated at compile time:\r\n\r\n```\r\n   Compiling http-api-server v0.1.0 (file:///home/micucci/src/git/paidyx/http-api-server-rust)\r\nerror: `data` route parameters can only be used with payload supporting methods\r\n   --> src/lib.rs:371:27\r\n    |\r\n371 |     #[get(\"/testGetBody\", data=\"<data>\")]\r\n    |                           ^^^^^^^^^^^^^\r\n    |\r\n    = note: 'GET' does not support payloads\r\n```\r\n\r\nHowever, according to the HTTP Spec section 4.3:\r\n\r\n```\r\n The presence of a message-body in a request is signaled by the\r\n   inclusion of a Content-Length or Transfer-Encoding header field in\r\n   the request's message-headers. A message-body MUST NOT be included in\r\n   a request if the specification of the request method (section 5.1.1)\r\n   does not allow sending an entity-body in requests. \r\n```\r\n\r\nSection 9.3 (GET) has no verbiage forbidding a message-body entity (other sections, like TRACE, specifically forbid it).\r\n\r\nThis is discussed here:\r\n\r\nhttps://stackoverflow.com/questions/2064281/sending-post-data-with-get-request-valid\r\n\r\nFor an example, the ElasticSearch API allows a GET with an entity body.  And the spec does not preclude it.  Even though it is not common, and many people have varying opinions on whether it \"should\" be done, because it is allowed by the standard, I feel a framework like Rocket should allow it, and let the framework user decide whether to implement it or not.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/SergioBenitez/Rocket/issues/comments/411961791","html_url":"https://github.com/SergioBenitez/Rocket/issues/731#issuecomment-411961791","issue_url":"https://api.github.com/repos/SergioBenitez/Rocket/issues/731","id":411961791,"node_id":"MDEyOklzc3VlQ29tbWVudDQxMTk2MTc5MQ==","user":{"login":"SergioBenitez","id":1480321,"node_id":"MDQ6VXNlcjE0ODAzMjE=","avatar_url":"https://avatars3.githubusercontent.com/u/1480321?v=4","gravatar_id":"","url":"https://api.github.com/users/SergioBenitez","html_url":"https://github.com/SergioBenitez","followers_url":"https://api.github.com/users/SergioBenitez/followers","following_url":"https://api.github.com/users/SergioBenitez/following{/other_user}","gists_url":"https://api.github.com/users/SergioBenitez/gists{/gist_id}","starred_url":"https://api.github.com/users/SergioBenitez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SergioBenitez/subscriptions","organizations_url":"https://api.github.com/users/SergioBenitez/orgs","repos_url":"https://api.github.com/users/SergioBenitez/repos","events_url":"https://api.github.com/users/SergioBenitez/events{/privacy}","received_events_url":"https://api.github.com/users/SergioBenitez/received_events","type":"User","site_admin":false},"created_at":"2018-08-10T03:04:36Z","updated_at":"2018-08-10T03:04:36Z","author_association":"OWNER","body":"Duplicate of #622, and already fixed in master. "}}
{"actor":{"display_login":"SergioBenitez"}}