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

improper headers format in mockit-routes/configuration/routes.json #56

Closed
monkeyWzr opened this issue Jul 1, 2019 · 1 comment
Closed

Comments

@monkeyWzr
Copy link

Hi there @boyney123
First of all, thanks for your brilliant work!

What you did:

cd mockit-routes
npm install
npm run start

Then visit http://localhost:3000/random

What happened:

TypeError: headers.forEach is not a function
    at /mnt/e/git/mockit/mockit-routes/src/index.js:33:15
    at Layer.handle [as handle_request] (/mnt/e/git/mockit/mockit-routes/node_modules/express/lib/router/layer.js:95:5)
    at next (/mnt/e/git/mockit/mockit-routes/node_modules/express/lib/router/route.js:137:13)
    at Route.dispatch (/mnt/e/git/mockit/mockit-routes/node_modules/express/lib/router/route.js:112:3)
    at Layer.handle [as handle_request] (/mnt/e/git/mockit/mockit-routes/node_modules/express/lib/router/layer.js:95:5)
    at /mnt/e/git/mockit/mockit-routes/node_modules/express/lib/router/index.js:281:22
    at Function.process_params (/mnt/e/git/mockit/mockit-routes/node_modules/express/lib/router/index.js:335:12)
    at next (/mnt/e/git/mockit/mockit-routes/node_modules/express/lib/router/index.js:275:10)
    at cors (/mnt/e/git/mockit/mockit-routes/node_modules/cors/lib/index.js:188:7)
    at /mnt/e/git/mockit/mockit-routes/node_modules/cors/lib/index.js:224:17

Problem description:

the headers in routes.json should be an array of {header, value} objects as it is in root's routes.json

Suggested solution:

Update mockit-routes/configuration/routes.json

...
"headers": [{
        "header": "x-testing",
        "value": "tester"
      }, {
        "header": "x-testing2",
        "value": "tester2"
      }, {
        "header": "x-testing3",
        "value": "tester3"
      }],
...
@boyney123
Copy link
Owner

First of all, thanks for your brilliant work!

Thanks, I'm glad you like it :)

Thanks for raising this issue/bug, I have put a fix in for a release 1.1.1.

#57

Thanks again @monkeyWzr

boyney123 added a commit that referenced this issue Jul 2, 2019
* DB - Fix for #56 - Header format fixed

* DB - Update to changelog
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

2 participants