Недействительный Json, возвращенный вебхуком Taiga в Github, но он кажется действительным?

Я пытаюсь настроить веб-перехватчик между Taiga и Github, полезные данные ниже, но получаю ответ:

{"_error_message": "The payload is not a valid json", "_error_type": "taiga.base.exceptions.BadRequest"}

Вот полезная нагрузка:

{
  "zen": "Avoid administrative distraction.",
  "hook_id": 58924287,
  "hook": {
    "type": "Repository",
    "id": 58924287,
    "name": "web",
    "active": true,
    "events": [
      "*"
    ],
    "config": {
      "content_type": "form",
      "insecure_ssl": "0",
      "secret": "********",
      "url": "https://api.taiga.io/api/v1/github-hook?project=291735"
    },
    "updated_at": "2018-10-24T23:40:03Z",
    "created_at": "2018-10-24T23:40:03Z",
    "url": "https://api.github.com/repos/AncientSwordRage/multivaria/hooks/58924287",
    "test_url": "https://api.github.com/repos/AncientSwordRage/multivaria/hooks/58924287/test",
    "ping_url": "https://api.github.com/repos/AncientSwordRage/multivaria/hooks/58924287/pings",
    "last_response": {
      "code": null,
      "status": "unused",
      "message": null
    }
  },
  "repository": {
    "id": 154575276,
    "node_id": "MDEwOlJlcG9zaXRvcnkxNTQ1NzUyNzY=",
    "name": "multivaria",
    "full_name": "AncientSwordRage/multivaria",
    "private": false,
    "owner": {
      "login": "AncientSwordRage",
      "id": 5961746,
      "node_id": "MDQ6VXNlcjU5NjE3NDY=",
      "avatar_url": "https://avatars3.githubusercontent.com/u/5961746?v=4",
      "gravatar_id": "",
      "url": "https://api.github.com/users/AncientSwordRage",
      "html_url": "https://github.com/AncientSwordRage",
      "followers_url": "https://api.github.com/users/AncientSwordRage/followers",
      "following_url": "https://api.github.com/users/AncientSwordRage/following{/other_user}",
      "gists_url": "https://api.github.com/users/AncientSwordRage/gists{/gist_id}",
      "starred_url": "https://api.github.com/users/AncientSwordRage/starred{/owner}{/repo}",
      "subscriptions_url": "https://api.github.com/users/AncientSwordRage/subscriptions",
      "organizations_url": "https://api.github.com/users/AncientSwordRage/orgs",
      "repos_url": "https://api.github.com/users/AncientSwordRage/repos",
      "events_url": "https://api.github.com/users/AncientSwordRage/events{/privacy}",
      "received_events_url": "https://api.github.com/users/AncientSwordRage/received_events",
      "type": "User",
      "site_admin": false
    },
    "html_url": "https://github.com/AncientSwordRage/multivaria",
    "description": "Multivariate Hypergeometric Probabilities (In Space!)",
    "fork": false,
    "url": "https://api.github.com/repos/AncientSwordRage/multivaria",
    "forks_url": "https://api.github.com/repos/AncientSwordRage/multivaria/forks",
    "keys_url": "https://api.github.com/repos/AncientSwordRage/multivaria/keys{/key_id}",
    "collaborators_url": "https://api.github.com/repos/AncientSwordRage/multivaria/collaborators{/collaborator}",
    "teams_url": "https://api.github.com/repos/AncientSwordRage/multivaria/teams",
    "hooks_url": "https://api.github.com/repos/AncientSwordRage/multivaria/hooks",
    "issue_events_url": "https://api.github.com/repos/AncientSwordRage/multivaria/issues/events{/number}",
    "events_url": "https://api.github.com/repos/AncientSwordRage/multivaria/events",
    "assignees_url": "https://api.github.com/repos/AncientSwordRage/multivaria/assignees{/user}",
    "branches_url": "https://api.github.com/repos/AncientSwordRage/multivaria/branches{/branch}",
    "tags_url": "https://api.github.com/repos/AncientSwordRage/multivaria/tags",
    "blobs_url": "https://api.github.com/repos/AncientSwordRage/multivaria/git/blobs{/sha}",
    "git_tags_url": "https://api.github.com/repos/AncientSwordRage/multivaria/git/tags{/sha}",
    "git_refs_url": "https://api.github.com/repos/AncientSwordRage/multivaria/git/refs{/sha}",
    "trees_url": "https://api.github.com/repos/AncientSwordRage/multivaria/git/trees{/sha}",
    "statuses_url": "https://api.github.com/repos/AncientSwordRage/multivaria/statuses/{sha}",
    "languages_url": "https://api.github.com/repos/AncientSwordRage/multivaria/languages",
    "stargazers_url": "https://api.github.com/repos/AncientSwordRage/multivaria/stargazers",
    "contributors_url": "https://api.github.com/repos/AncientSwordRage/multivaria/contributors",
    "subscribers_url": "https://api.github.com/repos/AncientSwordRage/multivaria/subscribers",
    "subscription_url": "https://api.github.com/repos/AncientSwordRage/multivaria/subscription",
    "commits_url": "https://api.github.com/repos/AncientSwordRage/multivaria/commits{/sha}",
    "git_commits_url": "https://api.github.com/repos/AncientSwordRage/multivaria/git/commits{/sha}",
    "comments_url": "https://api.github.com/repos/AncientSwordRage/multivaria/comments{/number}",
    "issue_comment_url": "https://api.github.com/repos/AncientSwordRage/multivaria/issues/comments{/number}",
    "contents_url": "https://api.github.com/repos/AncientSwordRage/multivaria/contents/{+path}",
    "compare_url": "https://api.github.com/repos/AncientSwordRage/multivaria/compare/{base}...{head}",
    "merges_url": "https://api.github.com/repos/AncientSwordRage/multivaria/merges",
    "archive_url": "https://api.github.com/repos/AncientSwordRage/multivaria/{archive_format}{/ref}",
    "downloads_url": "https://api.github.com/repos/AncientSwordRage/multivaria/downloads",
    "issues_url": "https://api.github.com/repos/AncientSwordRage/multivaria/issues{/number}",
    "pulls_url": "https://api.github.com/repos/AncientSwordRage/multivaria/pulls{/number}",
    "milestones_url": "https://api.github.com/repos/AncientSwordRage/multivaria/milestones{/number}",
    "notifications_url": "https://api.github.com/repos/AncientSwordRage/multivaria/notifications{?since,all,participating}",
    "labels_url": "https://api.github.com/repos/AncientSwordRage/multivaria/labels{/name}",
    "releases_url": "https://api.github.com/repos/AncientSwordRage/multivaria/releases{/id}",
    "deployments_url": "https://api.github.com/repos/AncientSwordRage/multivaria/deployments",
    "created_at": "2018-10-24T22:07:31Z",
    "updated_at": "2018-10-24T23:00:16Z",
    "pushed_at": "2018-10-24T23:00:14Z",
    "git_url": "git://github.com/AncientSwordRage/multivaria.git",
    "ssh_url": "[email protected]:AncientSwordRage/multivaria.git",
    "clone_url": "https://github.com/AncientSwordRage/multivaria.git",
    "svn_url": "https://github.com/AncientSwordRage/multivaria",
    "homepage": null,
    "size": 154,
    "stargazers_count": 0,
    "watchers_count": 0,
    "language": "JavaScript",
    "has_issues": true,
    "has_projects": true,
    "has_downloads": true,
    "has_wiki": true,
    "has_pages": false,
    "forks_count": 0,
    "mirror_url": null,
    "archived": false,
    "open_issues_count": 0,
    "license": {
      "key": "gpl-3.0",
      "name": "GNU General Public License v3.0",
      "spdx_id": "GPL-3.0",
      "url": "https://api.github.com/licenses/gpl-3.0",
      "node_id": "MDc6TGljZW5zZTk="
    },
    "forks": 0,
    "open_issues": 0,
    "watchers": 0,
    "default_branch": "master"
  },
  "sender": {
    "login": "AncientSwordRage",
    "id": 5961746,
    "node_id": "MDQ6VXNlcjU5NjE3NDY=",
    "avatar_url": "https://avatars3.githubusercontent.com/u/5961746?v=4",
    "gravatar_id": "",
    "url": "https://api.github.com/users/AncientSwordRage",
    "html_url": "https://github.com/AncientSwordRage",
    "followers_url": "https://api.github.com/users/AncientSwordRage/followers",
    "following_url": "https://api.github.com/users/AncientSwordRage/following{/other_user}",
    "gists_url": "https://api.github.com/users/AncientSwordRage/gists{/gist_id}",
    "starred_url": "https://api.github.com/users/AncientSwordRage/starred{/owner}{/repo}",
    "subscriptions_url": "https://api.github.com/users/AncientSwordRage/subscriptions",
    "organizations_url": "https://api.github.com/users/AncientSwordRage/orgs",
    "repos_url": "https://api.github.com/users/AncientSwordRage/repos",
    "events_url": "https://api.github.com/users/AncientSwordRage/events{/privacy}",
    "received_events_url": "https://api.github.com/users/AncientSwordRage/received_events",
    "type": "User",
    "site_admin": false
  }
}

(не думаю, что там есть что-то секретное)

Почему Тайга сообщает, что это неверно (я проверил - это не так)?


person Pureferret    schedule 26.10.2018    source источник


Ответы (1)


На стороне github проверьте, как настроен тип контента для вашего хука. Похоже, что он закодирован с помощью Form-Url (в полезной нагрузке, которую вы показываете:

...
"content_type": "form".
...

)

Убедитесь, что он настроен как application/json, как и ожидалось от taiga.

И да, когда вы смотрите на полезную нагрузку на стороне github, она отображает ее как JSON, даже если она отправляется как форма.

person Yann Cezard    schedule 03.04.2019
comment
Я рассмотрю это, как только смогу - person Pureferret; 03.04.2019