1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | var bodyParser = require("body-parser");
|
4 | exports.bodyParserGraphQL = function (options) { return function (req, res, next) {
|
5 | if (req.is('application/graphql')) {
|
6 | bodyParser.text({ type: 'application/graphql' })(req, res, function () {
|
7 | req.headers['content-type'] = 'application/json';
|
8 | req.body = {
|
9 | query: req.body
|
10 | };
|
11 | next();
|
12 | });
|
13 | }
|
14 | else {
|
15 | bodyParser.json(options)(req, res, next);
|
16 | }
|
17 | }; };
|
18 | exports.graphql = exports.bodyParserGraphQL;
|
19 |
|
\ | No newline at end of file |