【问题标题】:Cypress send XML requests (SOAP API)赛普拉斯发送 XML 请求(SOAP API)
【发布时间】:2021-01-04 08:31:36
【问题描述】:

我已尝试将我的 XML 作为请求发送。它看起来像这样:

let requestBody = function (method){ 
return "<x:Envelope"
+"xmlns:x='someurl'"
+"xmlns:inf='someurl'>"
  +"<x:Header/>"
    +"<x:Body>"
        +"<inf:"+method+"></inf:"+method+">"
            +"</x:Body>"
               +"</x:Envelope>" }
"\n<x:Envelope"+


Cypress.Commands.add("getReports", (soapAction) => {
    var parseXML
    var action=requestBody(soapAction)
      cy.fixture('urlFixture').then((url)=>{
      cy.request({
        method: 'POST',
        url: url.indoDistV1,
        headers: {
            soapAction:url.actionStartAdress+soapAction,
            "ContentType":"text/xml; charset=utf-8"

        },
        body: requestBody(soapAction)
    })
})
})

响应是 415 有人知道出了什么问题吗?

谢谢

【问题讨论】:

    标签: javascript api soap cypress


    【解决方案1】:

    我认为 "ContentType":"text/xml; charset=utf-8" 应该改为 "Content-Type":"text/xml; charset=utf-8"

    【讨论】:

      猜你喜欢
      • 2022-11-02
      • 1970-01-01
      • 2021-10-26
      • 2022-10-05
      • 1970-01-01
      • 1970-01-01
      • 2020-05-09
      • 2021-11-11
      • 2020-08-23
      相关资源
      最近更新 更多