Skip to content

Commit

Permalink
fix: Rest server on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonmit authored Jun 21, 2018
1 parent 58cb2e9 commit be5c473
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions packages/@pollyjs/node-server/src/express/register-api.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
import path from 'path';
import express from 'express';
import bodyParser from 'body-parser';
import express from 'express';
import nocache from 'nocache';
import API from '../api';
import DefaultConfig from '../config';

function prependSlash(slash = '') {
if (slash.startsWith('/')) {
return slash;
}

return `/${slash}`;
}

export default function registerAPI(app, config) {
config = { ...DefaultConfig, ...config };
config.apiNamespace = path.join('/', config.apiNamespace);
config.apiNamespace = prependSlash(config.apiNamespace);

const router = express.Router();
const api = new API(config.recordingsDir);
Expand Down

0 comments on commit be5c473

Please sign in to comment.