简体   繁体   English

如何在HttpBuilder-NG中配置日志记录以查看前后的内容

[英]How does one configure logging in HttpBuilder-NG to see what is going back and forth

I am exploring using HttpBuilder-NG to perform REST calls. 我正在探索使用HttpBuilder-NG来执行REST调用。 My first attempt simply gives me a groovy.net.http.HttpException with a traceback. 我的第一次尝试只是给了我一个带有回溯的groovy.net.http.HttpException。 No other details. 没有其他细节。 Using the previous HttpBuilder I was able to turn on logging to see what is sent and received. 使用之前的HttpBuilder,我可以打开日志记录以查看发送和接收的内容。

The code is pretty simple: 代码非常简单:

    def jiraUrl = 'https://gpdevjira.broadinstitute.org:8443/rest/api/2'
def username = 'releng'
def password = 'releng'


@Test
void testGetIssue() {

    def jira = configure {
        request.uri = jiraUrl
        request.auth.basic username, password
    }

    assert jira

    String text = jira.get(String){
        request.uri.path = "/issue/$testIssue"
    }

    assert text
}

我认为已经回答了使用HttpBuilder-NG的Apache客户端实现的建议

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM