Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for RegExp when specifying paths #38

Open
bruno-delfino1995 opened this issue Mar 13, 2018 · 0 comments
Open

Support for RegExp when specifying paths #38

bruno-delfino1995 opened this issue Mar 13, 2018 · 0 comments

Comments

@bruno-delfino1995
Copy link

bruno-delfino1995 commented Mar 13, 2018

Given this project is based on Nock, I supposed that it handled RegExp for specifying paths as Nock does.

I tested using the code provided in the README.md with some changes to match a path using a RegExp. Here follows

const http = require('http')
const hock = require('hock')
const request = require('request')

const mock = hock.createHock()
mock
  .get(/source$/)
  .reply(200, 'Hello!')

const server = http.createServer(mock.handler)
server.listen(1337, function () {
  console.log('Hock server listening at http://localhost:1337')
})

process.on('uncaughtException', (err) => {
  console.log('Whoops! There was an uncaught error\n', err)
})

When accessing http://localhost:1337/source I get an error for a non-matching route. Do you have any plan to support RegExp as Nock does?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant