【发布时间】:2020-12-11 17:40:28
【问题描述】:
我正在尝试使用 jenkins httpRequest 来获取网页的内容,但奇怪的是我只得到 状态 200 而不是实际代码。以下是可重现的脚本及其控制台日志。
pipeline {
agent any
environment {
def response = httpRequest "https://news.yahoo.com/"
}
stages {
stage('Build'){
steps {
script {
echo "${response}"
echo response.getContent()
}
}
}
}
}
控制台日志:
HttpMethod: GET
URL: https://news.yahoo.com/
Sending request to url: https://news.yahoo.com/
Response Code: HTTP/1.1 200 OK
Success code from [100‥399]
....
Status: 200
....
hudson.remoting.ProxyException: groovy.lang.MissingMethodException: No signature of method: java.lang.String.getContent() is applicable for argument types: () values: []
【问题讨论】:
标签: jenkins jenkins-pipeline jenkins-plugins