0
我曾经见过的最奇怪的事情。我通过Postman
运行我的API调用,并且完全没有任何问题提出GET
请求。但是,下面的groovy代码拉groovyx.net.http.HttpResponseException: Internal Server Error
。我无法调试甚至调试,以了解我是否真的遇到了5xx错误或者我的代码被合法地破坏了。HttpResponseException:内部服务器错误
此外,我有过这样的代码,我重新拉那个工作代码,并有相同的错误。好奇的是,如果我的Maven
配置设置也会导致这个问题(不知道我要在哪里调试)。我也尝试过使用URIbuilder行来查看改变端点是否有帮助。
感谢您的帮助
abstract class HTTTPClient {
protected runGetRequest(String endpointPassedIn, RESTClient Client){
URIBuilder myEndpoint = new URIBuilder(new URI(Client.uri.toString() + endpointPassedIn))
//Error happens at the next Line
Client.get(uri: myEndpoint, contentType: ContentType.JSON)
LazyMap Response = unprocessedResponse.getData() as LazyMap
return Response
}
}
@Singleton(lazy = true)
class RequestService extends HTTTPClient {
private String auth = "myAuth"
private String baseURL = 'https://api.endpoint.net/'
private RESTClient client = setClient(baseURL, auth)
public buildResponseList(int pagesToPull) {
String endpoint = 'site/address.json?page='
ArrayList responseList = []
for (int i = 1; i <= pagesToPull; i++) {
LazyMap Response = runGetRequest(endpoint + i, client)
for (row in Response) {
responseList.add(row)
//TODO Add in items call here
}
}
return conversationList
}