-
Bug
-
Resolution: Unresolved
-
Major
-
None
-
Http Request plugin v1.9.0
Jenkins 2.277.3
When I am using the plugin like below, it works fine:
httpRequest customHeaders: [[name: 'Authorization', value: "Token harcodedtokenvaluehere"], [name: 'accept', value: "application/vnd.github.v3+json"]], httpMode: 'POST', requestBody: '{"head":"head","base":"base"}', url: "myurl"
But when I try to use withCredentials to pass Token value through Jenkins credentials, job fails with Response Code: HTTP/1.1 401 Unauthorized.
withCredentials([string(credentialsId: 'githubToken', variable: 'TOKEN')]) {
httpRequest customHeaders: [[name: 'Authorization', value: "Token %TOKEN%"], [name: 'accept', value: "application/vnd.github.v3+json"]], httpMode: 'POST', requestBody: '
', url: "myurl"
}