Last active
February 11, 2019 00:47
-
-
Save kprakobkit/e732451fa659bc7e429a7a522b5e8bcf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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