xiongwilee / Gracejs

A Nodejs BFF framework, build with koa2(基于koa2的标准前后端分离框架)
https://grace.wilee.me
MIT License
1.39k stars 238 forks source link

Proxy-Post传XML参数时会被放进Form中。 #38

Closed ewxm closed 7 years ago

ewxm commented 7 years ago

请求参数

{
    "form": "<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:bsas="http://siebel.com/loyalty/BSAssociateMemberWS">
   <soapenv:Header/>
   <soapenv:Body>
      <bsas:AssociateMemberCreated>
         <AssistantId>xxx</AssistantId>
         <SSOID>xxx</SSOID>
         <Channel>xxxx</Channel>
         <Phone>xxx</Phone>
         <Brand>xxx</Brand>
         <StoreNum>xxx</StoreNum>
      </bsas:AssociateMemberCreated>
   </soapenv:Body>
</soapenv:Envelope>",
    "gzip": true,
    "headers": {
        "Content-Type": "text/xml",
        "accept": "*/*",
        "accept-encoding": "gzip, deflate",
        "cache-control": "no-cache",
        "connection": "keep-alive",
        "content-type": "application/x-www-form-urlencoded",
        "cookie": "22222=20111196",
        "host": "xxxxxxxxxxxx",
        "postman-token": "15c7d414-a53d-4eba-bf18-31af59f1c17f",
        "user-agent": "PostmanRuntime/3.0.11-hotfix.2",
        "user-host": "test:3000"
    },
    "json": true,
    "method": "POST",
    "timeout": 15000,
    "uri": "http://xxxxxx/xx/start.swe?SWEExtSource=WebService&SWEExtCmd=Execute&WSSOAP=xxx&UserName=xxxxxx&Password=xxx"
}

版本号

"version": "2.0.5"

注释掉json后发送就成功了

// 获取request参数
let opt = Object.assign({
uri: undefined, // 请求路径
method: undefined, // method
headers: undefined, // 头信息
gzip: true, //是否gzip
timeout: 15000, // 超时时间
// json: json, // json数据
form: form // post的form参数,默认为undefined
}, options);
console.log("opt: "+JSON.stringify(opt))
xiongwilee commented 7 years ago

已修复:https://github.com/xiongwilee/koa-grace/commit/712f585f22a546fefe91986d0127bd42aa594032