You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sometimes, APIs have a lookup service whereby an object can be retrieved from the service by something like an 'id'. It could return a wide variety of responses that can be difficult to template into a single file.
To make it easier to mock, one idea is to have each of the varied responses available as a file itself so that requests to …/lookup/:id load a filename from the system based on that :id parameter. For example, /lookup/abc123 could load the template abc123.json, or maybe it loads abc123-GET.json.
The solution I'd like to see here is to support the JSON templating language in the filename specification for a route.
Alternatives to this idea include just supporting url parameters in the filename specification. Supporting an include statement within the template that could assemble the response by including parts of the response from other files could also prove very flexible and easier to implement.
The text was updated successfully, but these errors were encountered:
I think that adding templating support in the file path input would be sufficient, what do you think?
First step would be to allow input edition, second step allow templating. So you could browser for a file and write something like this: c:/folder/user_data_{{routeParam 'userId'}}.json
What do you think?
I realize that this is exactly what you proposed :)
So, it's implemented for the next release, I will also add an option to be able to serve a file OR get the file content and put in in the response body instead.
Sometimes, APIs have a lookup service whereby an object can be retrieved from the service by something like an 'id'. It could return a wide variety of responses that can be difficult to template into a single file.
To make it easier to mock, one idea is to have each of the varied responses available as a file itself so that requests to …/lookup/:id load a filename from the system based on that :id parameter. For example, /lookup/abc123 could load the template abc123.json, or maybe it loads abc123-GET.json.
The solution I'd like to see here is to support the JSON templating language in the filename specification for a route.
Alternatives to this idea include just supporting url parameters in the filename specification. Supporting an include statement within the template that could assemble the response by including parts of the response from other files could also prove very flexible and easier to implement.
The text was updated successfully, but these errors were encountered: