Skip to content

Instantly share code, notes, and snippets.

@kprakobkit kprakobkit/setup.js
Last active Feb 11, 2019

Embed
What would you like to do?
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
You can’t perform that action at this time.