Initial Save
This commit is contained in:
27
node_modules/@apollographql/graphql-upload-8-fork/lib/graphqlUploadKoa.js
generated
vendored
Normal file
27
node_modules/@apollographql/graphql-upload-8-fork/lib/graphqlUploadKoa.js
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
'use strict'
|
||||
|
||||
exports.__esModule = true
|
||||
exports.graphqlUploadKoa = void 0
|
||||
|
||||
var _processRequest = require('./processRequest')
|
||||
|
||||
const graphqlUploadKoa = ({
|
||||
processRequest = _processRequest.processRequest,
|
||||
...processRequestOptions
|
||||
} = {}) => async (ctx, next) => {
|
||||
if (!ctx.request.is('multipart/form-data')) return next()
|
||||
const finished = new Promise(resolve => ctx.req.on('end', resolve))
|
||||
|
||||
try {
|
||||
ctx.request.body = await processRequest(
|
||||
ctx.req,
|
||||
ctx.res,
|
||||
processRequestOptions
|
||||
)
|
||||
await next()
|
||||
} finally {
|
||||
await finished
|
||||
}
|
||||
}
|
||||
|
||||
exports.graphqlUploadKoa = graphqlUploadKoa
|
||||
Reference in New Issue
Block a user