[Server] text/plainの場合もJSONとして解析するように

This commit is contained in:
syuilo 2017-02-12 02:18:58 +09:00
parent 38d9f736aa
commit 680f9a0b5c
2 changed files with 6 additions and 1 deletions

View file

@ -18,7 +18,9 @@ const app = express();
app.disable('x-powered-by');
app.set('etag', false);
app.use(bodyParser.urlencoded({ extended: true }));
app.use(bodyParser.json());
app.use(bodyParser.json({
type: ['application/json', 'text/plain']
}));
app.use(cors({
origin: true
}));

View file

@ -21,6 +21,9 @@ const app = express();
app.disable('x-powered-by');
app.use(bodyParser.urlencoded({ extended: true }));
app.use(bodyParser.json({
type: ['application/json', 'text/plain']
}));
app.use(compression());
/**