UNPKG

647 BJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3var bodyParser = require("body-parser");
4exports.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}; };
18exports.graphql = exports.bodyParserGraphQL;
19//# sourceMappingURL=index.js.map
\No newline at end of file