我正在尝试将jenkins管道(groovy)的发帖请求发送到wordpress动作。
我对詹金斯使用HttpRequest插件,代码看起来像
def reqBody = "{\"action\":\"action_name\"}"
def response = httpRequest consoleLogResponseBody: true, contentType: 'APPLICATION_JSON', httpMode: "POST", requestBody: reqBody, url:"http://websitename.com/wp-admin/admin-ajax.php";
使用此代码运行作业后,我得到了408 Request Timeout
。
即使是动作名称或任何错误,我也应该得到400。
我还检查了从邮递员发送到相同wordpress动作的类似请求,并且所有内容都可以使用200个代码状态,因此wordpress效果很好。
好的,所以我认为问题出在詹金斯身上,我尝试将请求发送到https://postman-echo.com/post进行测试。和工程。
因此,问题仅在詹金斯和WordPress之间。我在做什么错了?