const nock = require('nock@13.1.3')
const scope = nock('http://localhost')
const axios = require('axios')
scope.get('/boo')
.reply(200, 'ok')
try{
await axios.get('http://localhost/boo')
console.log('OK, Expected to match')
}catch(e) {
console.log('Not matched?')
console.log(e)
}
nock.cleanAll()
scope
.matchHeader('authorization','foo')
.get('/boo')
.reply(200, 'ok')
try{
await axios.get('http://localhost/boo')
}catch(e) {
console.log('OK, expected header not match')
console.log(e)
}
nock.cleanAll()
scope.get('/boo')
.reply(200, 'ok')
try{
await axios.get('http://localhost/boo')
console.log('OK, Expected to match')
}catch(e) {
console.log('Not matched?')
console.log(e)
}