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

Character encoding with HTTPBuilder

Gleb Kartashov December 12, 2019

Hi there. I'm using JMWE add-on to perform a HTTP POST request on an issue as a post function. Here's my code:

import groovyx.net.http.HTTPBuilder;
import static groovyx.net.http.ContentType.*;
import groovyx.net.http.ContentType;
import static groovyx.net.http.Method.*;

def http = new HTTPBuilder('myhost.com')
http.request( POST ) {
uri.path = '/'
requestContentType = ContentType.JSON
body = [title: issue.get("summary"), desc: issue.get("description")]
log.info(body.title)
response.success = { resp ->
log.info( "POST response status: "+resp.statusLine+"}")
}
}

This is what request looks like from my web service side:image.pngIn Jira and Groovy test console characters look fine.

How do I fix this?

1 answer

0 votes
David Fischer
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 18, 2019

Hi Gleb,

I don't believe the encoding is wrong - it's just that your console on the web service side cannot print Unicode characters. JSON supports Unicode without any problem, so your request body is correct.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events