Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Error 500 when try make transition via rest

aas
Contributor
November 18, 2019

Hello everybody. I try to make transition in another instance of Jira and have 500 error in response and also at that time have exception: 

org.apache.http.ConnectionClosedException: Premature end of chunk coded message body: closing chunk expected

 

def http = new HTTPBuilder("${addressJira}/rest/api/2/issue/${fieldValue}/transitions")
try
{
  http.request(POST, ContentType.JSON) {
requestContentType = ContentType.JSON
request.addHeader("authorization: Basic ${authString}", "ContentType:        application/json")
body = ["transition" : ["id": "11"]]

response.success = { resp ->
log.info("Successful " + resp.status.toString())
}

response.failure = { resp ->
HttpResponseDecorator.HeadersDecorator headers = resp.getHeaders()
for (Iterator i = headers.iterator(); i.hasNext();){
def header = i.next()
log.info(header)
}
log.warn("response is : " + resp.getData().toString())
}
}
} catch(Exception e){
log.warn("Eception : " + e)
}

I tried to look at response like that 

resp.getEntity().getContent().getText()

and found out that :

java.lang.IllegalArgumentException: Input byte array has incorrect ending byte at 36

 Is it means that my request is wrong?

1 answer

0 votes
aas
Contributor
November 19, 2019

If it interesting to somebody I found out the solution. 500 error was because of apache.

ConnectionClosedException was because of small time out 

The IllegalArgumentException problem was because of incorrect auth headers.

def authString = "${user}:${password}".bytes.encodeBase64().toString() 
try {
http.request(POST, ContentType.JSON) {
headers.'Authorization' = "Basic ${authString}"

Suggest an answer

Log in or Sign up to answer