错误 ::: assertexpected { Object (content-security-policy, Expect-ct, ...) } 具有属性 text/plain;charset=ISO-8859-1
我尝试过下面的代码
describe("Assert header in response",function(){
beforeEach(function(){
cy.fixture("datainfixturefile").then(function(data){
this.data= data
var base=this.data.dcode
})
})
it.only('Valid Request',function(){
cy.request('POST',this.data.BaseURL+this.data.ValidReq).then((response) =>
{
expect(response).to.have.property('status',200);
expect(response.body).contains('APP-');
expect(response.headers).to.have.property("Content-Type", "text/plain;charset=ISO-8859-1");
})
})
Run Code Online (Sandbox Code Playgroud)
小智 5
我认为您想要指定键和值
expect(response).to.have.property('status', 200)
expect(response.headers).to.have.property('content-type', 'text/plain; charset=ISO-8859-1')
Run Code Online (Sandbox Code Playgroud)
查看方法属性
.property(名称[, val[, 消息]])
- @param { 字符串 } 名称
- @param { 混合 } val (可选)
- @param { String } 消息可选
断言目标具有给定键名称的属性
| 归档时间: |
|
| 查看次数: |
106 次 |
| 最近记录: |