The controller that gets and deletes single imposters
- Source:
Methods
(async) del(request, response) → {Object}
The function responding to DELETE /imposters/:id
Parameters:
Name | Type | Description |
---|---|---|
request |
Object | the HTTP request |
response |
Object | the HTTP response |
- Source:
Returns:
A promise for testing
- Type
- Object
(async) deleteStub(request, response) → {Object}
The function responding to DELETE /imposters/:port/stubs/:stubIndex
Removes a single stub without restarting the imposter
Parameters:
Name | Type | Description |
---|---|---|
request |
Object | the HTTP request |
response |
Object | the HTTP response |
Returns:
- promise for testing
- Type
- Object
(async) get(request, response) → {Object}
The function responding to GET /imposters/:id
Parameters:
Name | Type | Description |
---|---|---|
request |
Object | the HTTP request |
response |
Object | the HTTP response |
- Source:
Returns:
- the promise
- Type
- Object
(async) postProxyResponse(request, response) → {Object}
The function responding to POST /imposters/:id/_requests/:proxyResolutionKey
This is what protocol implementations call after proxying a request so
mountebank can record the response and add behaviors to
Parameters:
Name | Type | Description |
---|---|---|
request |
Object | the HTTP request |
response |
Object | the HTTP response |
Returns:
- the promise
- Type
- Object
(async) postRequest(request, response) → {Object}
The function responding to POST /imposters/:id/_requests
This is what protocol implementations call to send the JSON request
structure to mountebank, which responds with the JSON response structure
Parameters:
Name | Type | Description |
---|---|---|
request |
Object | the HTTP request |
response |
Object | the HTTP response |
Returns:
- the promise
- Type
- Object
(async) postStub(request, response) → {Object}
The function responding to POST /imposters/:port/stubs
Creates a single stub without restarting the imposter
Parameters:
Name | Type | Description |
---|---|---|
request |
Object | the HTTP request |
response |
Object | the HTTP response |
Returns:
- promise for testing
- Type
- Object
(async) putStub(request, response) → {Object}
The function responding to PUT /imposters/:id/stubs/:stubIndex
Overwrites a single stub without restarting the imposter
Parameters:
Name | Type | Description |
---|---|---|
request |
Object | the HTTP request |
response |
Object | the HTTP response |
Returns:
- promise for testing
- Type
- Object
(async) putStubs(request, response) → {Object}
The function responding to PUT /imposters/:id/stubs
Overwrites the stubs list without restarting the imposter
Parameters:
Name | Type | Description |
---|---|---|
request |
Object | the HTTP request |
response |
Object | the HTTP response |
Returns:
- promise for testing
- Type
- Object
(async) resetProxies(request, response) → {Object}
Corresponds to DELETE /imposters/:id/savedProxyResponses
Removes all saved proxy responses
Parameters:
Name | Type | Description |
---|---|---|
request |
Object | the HTTP request |
response |
Object | the HTTP response |
- Source:
Returns:
A promise for testing
- Type
- Object
(async) resetRequests(request, response) → {Object}
Corresponds to DELETE /imposters/:id/savedRequests
Removes all saved requests
Parameters:
Name | Type | Description |
---|---|---|
request |
Object | the HTTP request |
response |
Object | the HTTP response |
- Source:
Returns:
A promise for testing
- Type
- Object
(inner) create(protocols, imposters, logger, allowInjection) → {Object}
Creates the imposter controller
Parameters:
Name | Type | Description |
---|---|---|
protocols |
Object | the protocol implementations supported by mountebank |
imposters |
Object | The map of ports to imposters |
logger |
Object | The logger |
allowInjection |
Boolean | Whether injection is allowed or not |
- Source:
Returns:
- Type
- Object