Conversation
There was a problem hiding this comment.
We'll need to do a bit more than this for cases where new Stubby().start(options) is used, as it is not always started from a command-line invocation.
|
I've also been thinking about some sort of "template" request/response that can fill in the defaults for all missing values in configured endpoints. This would be identified in some fashion in the supplied yaml file - request: ...
response: ...
...
defaults:
request: ...
response: ... |
|
Good idea having it templated and built into stubby4node. However, it would then make the YAML files not portable to other stubby systems. Currently, we have a this but it is just a simple script that replaces varaibles and seperate from stubby4node. |
|
Having the defaults passed as a separate argument would preserve the array structure in the data file and be backward-compatible from the API standpoint. Everything within the defaults would be a simple stubby --data data.yaml --defaults <<EOF
response:
latency: 800
EOFvar stubby = new require('stubby').Stubby();
stubby.start({
data: [...],
defaults: {
response: {
latency: 800
}
}
}); |
|
Your idea makes a lot of sense and better structured |
|
@mrak this sounds like a really good idea. This will help with DRY especially in header which typically looks identical across all calls (e.g. authentication token). |
|
Can this be re-reviewed? Functionality would be greatly appreciated |
closes issue #41
Please code review @mrak