gstroup / apimocker

node.js module to run a simple http server for mock service responses.
MIT License
280 stars 81 forks source link

Added code to support file templateing. #42

Closed Samurai336 closed 8 years ago

Samurai336 commented 8 years ago

You can now add template tokens to you json.

gstroup commented 8 years ago

This looks like it could be useful. I have seen a real API that sends back request parameters in the response. My only concern is that this is doing multiple string.replace() calls on every response. I'll take a look and try to get it merged and published soon. Thank you for the PR!

Samurai336 commented 8 years ago

Hi gstroup:

Other then looping though for each token how would you go about doing it?

Also, your comment made me realize I was only updating the first instance of the token, so I've updated the code to replace all instances.

Samurai336 commented 8 years ago

Hi gstroup:

Any updates?

gstroup commented 8 years ago

Hi, I'm fine with looping through for each token. I was thinking about people that don't want to use templates... This code will still loop through for each param. Can we add an option, then check: if (options.fillTemplate) { call fillTemplate function }

What do you think?

Overall, looks good! Thank you.

Samurai336 commented 8 years ago

Hi gstroup:

That makes sense! I've gone ahead and done that. Let me know if you agree with my naming and implementation.

gstroup commented 8 years ago

Looks good.  Thanks!!  I'll get it merged and published as soon as I can.    -Greg From: Samurai336 notifications@github.com To: gstroup/apimocker apimocker@noreply.github.com Cc: Greg Stroup gstroup@gmail.com Sent: Tuesday, January 26, 2016 1:10 PM Subject: Re: [apimocker] Added code to support file templateing. (#42)

Hi gstroup:That makes sense! I've gone ahead and done that. Let me know if you agree with my naming and implementation. — Reply to this email directly or view it on GitHub.

Samurai336 commented 8 years ago

Any news on merging this?

gstroup commented 8 years ago

Sorry for the delay. It's merged now, and published as version 0.4.11. Thank you!

Samurai336 commented 8 years ago

Awesome! Thank you.