0
나는 이상한 일을 한동안 보았습니다. Postman
을 통해 API 호출을 실행하고 GET
요청에 전혀 문제가 없습니다. 그러나 아래 그루비 코드는 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
}