Lucas Crostarosa Lucas Crostarosa - 1 year ago 71
reST (reStructuredText) Question

HttpResponseException: Internal Server Error

Weirdest thing I have seen in a while. I run my API call through

and have no problems at all making a
request. However, the groovy code below pulls Internal Server Error
. I am not able to pull even debug to understand if I am actually getting a 5xx error or my code is legitimately broken.

Additionally I have had code like this work in the past, I re-pulled that working code and have the same error. Curious if my
config settings would be causing the issue as well (Not sure where I would have to debug). I have also tried messing with the URIbuilder line to see if changing the endpoints would help.

Thanks for helping

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 = ''

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) {
//TODO Add in items call here
return conversationList

Answer Source

The error was due to encoding in the Authorization, was on the server side, not the code side