Skip to content

Instantly share code, notes, and snippets.

@kprakobkit
Last active February 11, 2019 00:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kprakobkit/e732451fa659bc7e429a7a522b5e8bcf to your computer and use it in GitHub Desktop.
Save kprakobkit/e732451fa659bc7e429a7a522b5e8bcf to your computer and use it in GitHub Desktop.
import request from "request-promise";
const setup = async () => {
// delete the current imposter running on http://mountebank:3014
await request({
method: "DELETE",
uri: "http://mountebank:2525/imposters/3014"
});
// create a new imposter on http://mountebank:3014
await request({
method: "POST",
json: true,
uri: "http://mountebank:2525/imposters",
body: {
port: "3014",
protocol: "http",
name: "origin",
defaultResponse: {
statusCode: 404,
body: "Error"
},
stubs: [
{
predicates: [
{
contains: {
method: "POST",
path: "/emails"
}
}
],
responses: [
{
is: {
statusCode: 201,
body: {
status: "success"
}
}
}
]
}
]
}
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment