Jenkins Bitbucket 插件 - 无法解析 POST 数据
Jenkins Bitbucket Plugin - Cannot parse POST data
向 /jenkins/bitbucket-hook
发送 POST 请求导致 500 错误:
javax.servlet.ServletException: net.sf.json.JSONException: A JSONObject text must begin with '{' at character 0 of
无论内容类型或正文数据如何。
发送的主体数据是 Bitbucket 概述的数据:
{
"canon_url": "https://bitbucket.org",
"commits": [
{
"author": "marcus",
"branch": "master",
"files": [
{
"file": "somefile.py",
"type": "modified"
}
],
"message": "Added some more things to somefile.py\n",
"node": "620ade18607a",
"parents": [
"702c70160afc"
],
"raw_author": "Marcus Bertrand <marcus@somedomain.com>",
"raw_node": "620ade18607ac42d872b568bb92acaa9a28620e9",
"revision": null,
"size": -1,
"timestamp": "2012-05-30 05:58:56",
"utctimestamp": "2012-05-30 03:58:56+00:00"
}
],
"repository": {
"absolute_url": "/marcus/project-x/",
"fork": false,
"is_private": true,
"name": "Project X",
"owner": "marcus",
"scm": "git",
"slug": "project-x",
"website": "https://atlassian.com/"
},
"user": "marcus"
}
Jenkins 是最新版本,还有 Bitbucket 插件。
更新:我使用的是直接从BitBucket中获取的数据。
http://www.posttestserver.com/data/2015/05/20/sb/02.50.32555038623
我想我已经回答了我自己的问题。
为了消除该错误,我只需要在 url 中添加一个尾部斜杠...一些非常简单的方法对我有用。可能也值得其他人尝试。
向 /jenkins/bitbucket-hook
发送 POST 请求导致 500 错误:
javax.servlet.ServletException: net.sf.json.JSONException: A JSONObject text must begin with '{' at character 0 of
无论内容类型或正文数据如何。 发送的主体数据是 Bitbucket 概述的数据:
{
"canon_url": "https://bitbucket.org",
"commits": [
{
"author": "marcus",
"branch": "master",
"files": [
{
"file": "somefile.py",
"type": "modified"
}
],
"message": "Added some more things to somefile.py\n",
"node": "620ade18607a",
"parents": [
"702c70160afc"
],
"raw_author": "Marcus Bertrand <marcus@somedomain.com>",
"raw_node": "620ade18607ac42d872b568bb92acaa9a28620e9",
"revision": null,
"size": -1,
"timestamp": "2012-05-30 05:58:56",
"utctimestamp": "2012-05-30 03:58:56+00:00"
}
],
"repository": {
"absolute_url": "/marcus/project-x/",
"fork": false,
"is_private": true,
"name": "Project X",
"owner": "marcus",
"scm": "git",
"slug": "project-x",
"website": "https://atlassian.com/"
},
"user": "marcus"
}
Jenkins 是最新版本,还有 Bitbucket 插件。
更新:我使用的是直接从BitBucket中获取的数据。 http://www.posttestserver.com/data/2015/05/20/sb/02.50.32555038623
我想我已经回答了我自己的问题。
为了消除该错误,我只需要在 url 中添加一个尾部斜杠...一些非常简单的方法对我有用。可能也值得其他人尝试。