2016-10-05 36 views
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 
} 

回答

0

錯誤是由於在授權編碼,是在服務器端,而不是代碼側