{"action":"created","issue":{"url":"https://api.github.com/repos/sorrycc/roadhog/issues/719","repository_url":"https://api.github.com/repos/sorrycc/roadhog","labels_url":"https://api.github.com/repos/sorrycc/roadhog/issues/719/labels{/name}","comments_url":"https://api.github.com/repos/sorrycc/roadhog/issues/719/comments","events_url":"https://api.github.com/repos/sorrycc/roadhog/issues/719/events","html_url":"https://github.com/sorrycc/roadhog/issues/719","id":326886244,"node_id":"MDU6SXNzdWUzMjY4ODYyNDQ=","number":719,"title":"form表单post提交，服务端取不到参数值","user":{"login":"balancejia","id":2674373,"node_id":"MDQ6VXNlcjI2NzQzNzM=","avatar_url":"https://avatars3.githubusercontent.com/u/2674373?v=4","gravatar_id":"","url":"https://api.github.com/users/balancejia","html_url":"https://github.com/balancejia","followers_url":"https://api.github.com/users/balancejia/followers","following_url":"https://api.github.com/users/balancejia/following{/other_user}","gists_url":"https://api.github.com/users/balancejia/gists{/gist_id}","starred_url":"https://api.github.com/users/balancejia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/balancejia/subscriptions","organizations_url":"https://api.github.com/users/balancejia/orgs","repos_url":"https://api.github.com/users/balancejia/repos","events_url":"https://api.github.com/users/balancejia/events{/privacy}","received_events_url":"https://api.github.com/users/balancejia/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-05-28T03:40:07Z","updated_at":"2018-07-09T01:55:02Z","closed_at":null,"author_association":"NONE","body":"service中的代码：\r\nexport async function loginRemote(params) {\r\n  let formData=`username=${params.username}&password=${params.password}&imageCode=${params.imageCode}`;\r\n  return request('/authentication/form', {\r\n    method: 'POST',\r\n    body: formData,\r\n    type:'form',\r\n  });\r\n}\r\n\r\n\r\nrequest.js修改为：\r\nexport default function request(url, options) {\r\n  const defaultOptions = {\r\n    credentials: 'include',\r\n  };\r\n  const newOptions = { ...defaultOptions, ...options };\r\n  if (newOptions.method === 'POST' || newOptions.method === 'PUT') {\r\n    if((newOptions.type&&newOptions.type==='form')||(newOptions.body instanceof FormData)){\r\n      // newOptions.body is FormData\r\n      newOptions.headers = {\r\n        Accept: 'application/json',\r\n        'Content-Type':'application/x-www-form-urlencoded;charset=UTF-8',\r\n        ...newOptions.headers,\r\n      };\r\n    }else {\r\n      newOptions.headers = {\r\n        Accept: 'application/json',\r\n        'Content-Type': 'application/json; charset=utf-8',\r\n        ...newOptions.headers,\r\n      };\r\n      newOptions.body = JSON.stringify(newOptions.body);\r\n    }\r\n  }\r\n\r\n\r\n服务端java取参数方式：\r\nrequest.getParameter(\"username\");"},"comment":{"url":"https://api.github.com/repos/sorrycc/roadhog/issues/comments/403337978","html_url":"https://github.com/sorrycc/roadhog/issues/719#issuecomment-403337978","issue_url":"https://api.github.com/repos/sorrycc/roadhog/issues/719","id":403337978,"node_id":"MDEyOklzc3VlQ29tbWVudDQwMzMzNzk3OA==","user":{"login":"hosaos","id":21035910,"node_id":"MDQ6VXNlcjIxMDM1OTEw","avatar_url":"https://avatars0.githubusercontent.com/u/21035910?v=4","gravatar_id":"","url":"https://api.github.com/users/hosaos","html_url":"https://github.com/hosaos","followers_url":"https://api.github.com/users/hosaos/followers","following_url":"https://api.github.com/users/hosaos/following{/other_user}","gists_url":"https://api.github.com/users/hosaos/gists{/gist_id}","starred_url":"https://api.github.com/users/hosaos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hosaos/subscriptions","organizations_url":"https://api.github.com/users/hosaos/orgs","repos_url":"https://api.github.com/users/hosaos/repos","events_url":"https://api.github.com/users/hosaos/events{/privacy}","received_events_url":"https://api.github.com/users/hosaos/received_events","type":"User","site_admin":false},"created_at":"2018-07-09T01:55:02Z","updated_at":"2018-07-09T01:55:02Z","author_association":"NONE","body":"post的请求参数 不应该是一个json串？ 你这是get的参数吧"}}
{"actor":{"display_login":"hosaos"}}