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

Accept a module as response file to more dynamic responses #49

Closed
wants to merge 3 commits into from

Conversation

uhtred
Copy link

@uhtred uhtred commented Feb 11, 2016

Fixed old tests;

What do you think?

@lourenco
Copy link

👍

@mrak
Copy link
Owner

mrak commented Feb 12, 2016

For what it's worth, the example you have in the tests could be accomplished using Dynamic Token Interpolation

Keep in mind that dynamic require statements can be a memory leak and potentially fill the heap.

The idea is that you want to script a response? This project is meant to be a fixture-based server. This sort of thing may be better served with a more fully scriptable server product

@mrak
Copy link
Owner

mrak commented Feb 12, 2016

If folks really really desire this feature, we should think about a first-class way to incorporate it. In this PR's current state, users who have a .js file for their response body will have it executed instead of returned as a Content-Type: application/javascript".

Maybe something more along the lines of

- request:
    ...
  script: path/to/module.js

At that point though, the line between a stub server and a full express app with specific routes becomes very thin.

@mrak mrak closed this Oct 14, 2016
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

Successfully merging this pull request may close these issues.

None yet

3 participants