XMLHttpRequest POST请求无法传送数据

###正常用 XMLHttpRequest POST传送数据到服务端…服务端有收到请求.但是参数为 undefined. 改为 GET 正常
###版本 2.0
###语言 js
###服务端 nodejs koa2

// 客户端
sendPost ( url, reqData, callback ) {
        cc.log( '发送请求', url, reqData );
        var self = this;

        // 拼接请求数据
        var param = this.getHttpParams(reqData );

        console.log( param );

        // 发送请求
        let xhr = cc.loader.getXMLHttpRequest();
        xhr.onreadystatechange = function () {
            if ( xhr.readyState === 4 ) {
                if ( xhr.status >= 200 && xhr.status < 400 ) {
                    let reqponse = xhr.responseText;

                    let reqponseJson = null;
                    if ( reqponse ) {
                        reqponseJson = JSON.parse( reqponse );
                    }
                    callback && callback( reqponseJson );
                }
            } else {
                cc.warn( '请求失败', url, reqData );
            }

        };

        xhr.open( 'POST', url, true );

        if ( cc.sys.isNative ) {
            xhr.setRequestHeader( "Accept-Encoding", "gzip,deflate" );
        } else {
            xhr.setRequestHeader( 'Cpmtemt-Type', 'application/x-www-form-urlencoded' );
        }
        xhr.send( param );
    }


// 服务端
router.post('/recode' ,async ( ctx, next ) => {
   
// 打印内容 {} {}
    console.log( '收到请求 recode', ctx.request.body , ctx.query );

}; );


// 传入内容  param = "a=123456";

#急…在线等

xhr.setRequestHeader 移到 xhr.open 前面

测试…无效

koa-bodyparser 设置了吗

//if ( cc.sys.isNative ) {
// xhr.setRequestHeader( “Accept-Encoding”, “gzip,deflate” );
// } else {
xhr.setRequestHeader( ‘Cpmtemt-Type’, ‘application/x-www-form-urlencoded’ );
// }

//headParams 请求头参数
// params 请求体参数

xhr.open('POST', router, true);
        //设置提交数据的方式,application/json json传输数据用的比较多
        xhr.setRequestHeader("Content-Type", "application/json;charset=UTF-8");

        if (headParams) {
            for (var key in headParams) {
                xhr.setRequestHeader(key, headParams[key]);
            }
        }

xhr.send(JSON.stringify(params));