Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Error 500 when try make transition via rest Edited

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

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
TAGS

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you