脚本如下
var encryptor = new JSEncrypt() // 创建加密对象实例var pubKey = 'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCOLT9eEN7zqW43dpYBeAK39tUNfH4rms7BosrbqOQM0Q8v7OpLZepZTZWoDXO03y5+5VSfjHxIvsjOw2W3FMZ/NSVo9XkV6BeaK5AtFy3gq3gxB8fg5jiUVnry3bmYxAny7Xzn7ciJG7Ok/YJ8hiB4Hd1pLhJa8Y2glrOTOXawzwIDAQAB'
encryptor.setPublicKey(pubKey)//设置公钥
body = apt.request.request_bodys
var rsaPassWord = encryptor.encrypt(body)
最后要把 rsaPassWord 直接赋值给 body 参数 不用json形式
JSON.parse一下request
最后发送类似这样的请求
body = JSON.parse(request.request_bodys)这样是转成对象