mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-04 17:04:59 +03:00
Merge pull request #6714 from kevinansfield/allow-mocked-endpoints-in-dev
Enable ability to mock endpoints in development mode
This commit is contained in:
commit
999f7d43e2
@ -52,6 +52,22 @@ export default function () {
|
||||
this.namespace = 'ghost/api/v0.1'; // make this `api`, for example, if your API is namespaced
|
||||
// this.timing = 400; // delay for each request, automatically set to 0 during testing
|
||||
|
||||
// Mock endpoints here to override real API requests during development
|
||||
|
||||
// keep this line, it allows all other API requests to hit the real server
|
||||
this.passthrough();
|
||||
|
||||
// add any external domains to make sure those get passed through too
|
||||
this.passthrough('https://count.ghost.org/');
|
||||
this.passthrough('http://www.gravatar.com/**');
|
||||
}
|
||||
|
||||
// Mock all endpoints here as there is no real API during testing
|
||||
export function testConfig() {
|
||||
// this.urlPrefix = ''; // make this `http://localhost:8080`, for example, if your API is on a different server
|
||||
this.namespace = 'ghost/api/v0.1'; // make this `api`, for example, if your API is namespaced
|
||||
// this.timing = 400; // delay for each request, automatically set to 0 during testing
|
||||
|
||||
/* Authentication ------------------------------------------------------- */
|
||||
|
||||
this.post('/authentication/token', function () {
|
||||
@ -326,10 +342,3 @@ export default function () {
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
You can optionally export a config that is only loaded during tests
|
||||
export function testConfig() {
|
||||
|
||||
}
|
||||
*/
|
||||
|
@ -32,6 +32,7 @@ module.exports = function (environment) {
|
||||
ENV.APP.LOG_TRANSITIONS = true;
|
||||
ENV.APP.LOG_TRANSITIONS_INTERNAL = true;
|
||||
ENV.APP.LOG_VIEW_LOOKUPS = true;
|
||||
// Enable mirage here in order to mock API endpoints during development
|
||||
ENV['ember-cli-mirage'] = {
|
||||
enabled: false
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user