解决使用spring cloud config bus使用webhook自动刷新出现的400问题

1.发现问题

最近学习spring cloud,想要配合github提供的webhook功能实现线上刷新的功能(听上去很酷炫有没有)。踩了一通spring boot2.0的坑之后(主要就是2.0之后改变了配置刷新接口),总算可以通过手动发送/actuator/bus-refresh请求来实现配置的动态刷新,然而新的问题又来了,集成webhook后(需要进行内网穿透,推荐使用natapp),GitHub在进行post请求的同时默认会在body加上这么一串载荷(payload)

{
  "ref": "refs/heads/master",
  "before": "c34de85d9488373f09b0d7a32c03c1cc43039bfa",
  "after": "7f31e5860beb93f81376bd788c46906211b0b394",
  "created": false,
  "deleted": false,
  "forced": false,
  "base_ref": null,
  "compare": "https://github.com/Tinysakura/practice-config-repo/compare/c34de85d9488...7f31e5860beb",
  "commits": [
    {
      "id": "7f31e5860beb93f81376bd788c46906211b0b394",
      "tree_id": "b68b8ce368c12580bd852d8ed2eed7cbf6770075",
      "distinct": true,
      "message": "Update order-dev.yml",
      "timestamp": "2018-09-22T11:26:29+08:00",
      "url": "https://github.com/Tinysakura/practice-config-repo/commit/7f31e5860beb93f81376bd788c46906211b0b394",
      "author": {
        "name": "陈飞豪",
        "email": "2796191719@qq.com",
        "username": "Tinysakura"
      },
      "committer": {
        "name": "GitHub",
        "email": "noreply@github.com",
        "username": "web-flow"
      },
      "added": [

      ],
      "removed": [

      ],
      "modified": [
        "order/order-dev.yml"
      ]
    }
  ],
  "head_commit": {
    "id": "7f31e5860beb93f81376bd788c46906211b0b394",
    "tree_id": "b68b8ce368c12580bd852d8ed2eed7cbf6770075",
    "distinct": true,
    "message": "Update order-dev.yml",
    "timestamp": "2018-09-22T11:26:29+08:00",
    "url": "https://github.com/Tinysakura/practice-config-repo/commit/7f31e5860beb93f81376bd788c46906211b0b394",
    "author": {
      "name": "陈飞豪",
      "email": "2796191719@qq.com",
      "username": "Tinysakura"
    },
    "committer": {
      "name": "GitHub",
      "email": "noreply@github.com",
      "username": "web-flow"
    },
    "added": [

    ],
    "removed": [

    ],
    "modified": [
      "order/order-dev.yml"
    ]
  },
  "repository": {
    "id": 149753569,
    "node_id": "MDEwOlJlcG9zaXRvcnkxNDk3NTM1Njk=",
    "name": "practice-config-repo",
    "full_name": "Tinysakura/practice-config-repo",
    "private": false,
    "owner": {
      "name": &#
  • 5
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 22
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 22
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值