Jenkins HTTP请求插件授权错误

时间:2019-07-11 20:24:00

标签: jenkins jenkins-pipeline httprequest jenkins-plugins jenkins-groovy

所以我正在使用Jenkins HTTP Requests插件来执行POST方法。我已经在标题中指定了授权和apiKey,并且与请求一起作为标题发送。我仍然收到401未经授权的错误。有什么我可能会想念的吗?

这是发出的请求:

def response_POST = httpRequest httpMode: 'POST', acceptType: 'APPLICATION_JSON', contentType: 'APPLICATION_JSON', requestBody: payload, url: endpoint, customHeader: [[name: 'Authorization', value: 'apiToken <token>'], [name: 'apiUser', value: 'test'], [name: 'api_key', value: <value>]]

以下是错误:

Response Code: HTTP/1.1 401 Unauthorized

0 个答案:

没有答案