User-Agent breaks asynchttpPost (and maybe others?)

Hi All
Just thought I would share a recent discovery that I (finally, painfully) have tracked down.

I've got a driver in smartthings I've been trying to port for a long time, recently I dramatically improved my development environment (using vs-code with auto-uploading) so I've been porting my old smartthings code over.

Anyway I've tracked down an problem with asynchttpPost (possibly others also but only tested asynchttpPost) if you see a user-agent.

Below is a bit of code that only works if you remove the 'user-agent' portion. If user-agent is set then you get a 408 error but if you remove the user-agent then it completes successfully.

This examples uses the excellent postman-echo service to just echo back your response and only works, as I mentioned, if you remove the User-Agent from the header string (which I think should be allowed?)

 Duplicate the curl below

 curl --location --request POST '' \
 --data 'foo1=bar1' \
 --data 'foo2=bar2'
def _privateAsyncTest() {
    log.debug "_privateAsyncTest"

    def params = [
            uri    : '',
            timeout : 100,
                contentType: 'application/json',
                requestContentType: 'application/json',
                'User-Agent'  : 'dd',

            body   : [
                        "foo"  : "bar",
                        "foo1"  : "bar1",

    try {
        asynchttpPost("private_handler", params,params)
    } catch (e) {
        log.error "Error in asynchttpPos: $e \n $params"

def private_handler (response,data) {
    if (response.hasError()) {
        log.debug "private-handler raw error response: $response.errorData"
        log.debug "private-handler total error is $response"
        log.debug response.getStatus()
        log.debug "private-handler error data is $data"
    } else  {

            log.debug "private-handler was good! $response"


you can't just throw random parameters in there.. the list of parameters is defined in the docs;

User-Agent is a header, you'll have to put it in the headers parameter.

headers: ['User-Agent'  : 'dd'],

Literally I was coming in to delete this post as I was re-reading the documentation and realized that headers needed it's own group.

I think that worked in smartthings that way using their async code (but perhaps not? I'm pretty sure that is what I had in smarthigns)

Anyway thanks for the super fast response -- I'll keep this post up as a testament to reading the documentation.