We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9cb9a82 commit f1b05efCopy full SHA for f1b05ef
bin/http-server
@@ -204,10 +204,18 @@ function listen(port) {
204
205
if (proxyConfig) {
206
try {
207
- proxyConfig = JSON.parse(fs.readFileSync(proxyConfig));
+ if (fs.existsSync(proxyConfig)) {
208
+ proxyConfig = fs.readFileSync(proxyConfig, 'utf8');
209
+ }
210
+ if (typeof proxyConfig === 'string') {
211
+ proxyConfig = JSON.parse(proxyConfig);
212
213
+ if (typeof proxyConfig !== 'object') {
214
+ throw new Error('Invalid proxy config');
215
216
}
217
catch (err) {
- logger.info(chalk.red('Error: Invalid proxy config file'));
218
+ logger.info(chalk.red('Error: Invalid proxy config or file'));
219
process.exit(1);
220
221
// Proxy file overrides cli config
0 commit comments