使用邮递员测试API:我想使用邮递员验证url(href)中的语言代码

I am sending request in multiple language(say en,de) and I have stored res of all href link present in body.I want to validate if href in response has valid language code or not. href appears in response has language code as http(s)://abc.com/**en**/def.html or http(s)://lmn.com/**en_US**/def.html

//code example 
expectedUrl[1]=http(s)://abc.com/en/def.html
expectedUrl[2]=http(s)://abc.com/de/def.html
expectedUrl[3]=http(s)://abc.com/en_US/def.html
expectedUrl[2]=http(s)://abc.com/de_DE/def.html



pm.test(expectedUrl + ': check url is localised', function () {
  pm.expect(err).to.equal(null);//works fine
  pm.expect(res).to.have.property('code', 200);//works fine 
  pm.expect(res).to.have.property('status', 'OK');//works fine 
  pm.expect([expectedUrl[i]]).include({{lang}}); //How can i achieve this validation 
});

评论