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
Change injection functions to accept an object #294
Comments
Copying Igor Korobka's question: Hi, Is there a way to inject imposter port into the stubbed response? I'm trying to virtualize a configuration service that returns URLs to some other configuration files. To make it work with mountebank I'd need to compose each URL with {imposter-hostname}:{imposter-port}. I can workaround the hostname part by using "localhost" but can't seem to find a way to inject the port part. I'm creating imposters via mountebank REST API. Would appreciate any assistance! |
Merge the injectionState and imposterState for responses |
Taking a single object parameter allows us to add fields without creating a clunky interfade #294
Hey @bbyars , I think the code example for |
Thanks! |
Taking a single object parameter allows us to add fields without creating a clunky interfade bbyars#294
As injection functions have expanded in functionality, they've accrued additional parameters, making the signature feel ad-hoc. You may need the fourth parameter but not the third, and why are there so many parameters anyhow?
I'd like to convert all injection functions to accept a single object parameter that contains fields for the current values. For response injection, for example, the current signature is:
And the fifth
imposterState
parameter is undocumented, added way back when in a PR. Other new parameters will likewise just get shoved in at the end. I'd like to transform the signature to a single object containing the appropriate fields:For backwards compatibility, the old interface needs to still work. My preference would be to fix it in the
upcast
function incompatibility.js
, as I'd like to centralize all backwards compatibility logic where possible.The full list of injection functions can be found by searching for the literal string "eval(" and includes:
The text was updated successfully, but these errors were encountered: