Skip to content

Commit

Permalink
hapi: Switch uploads to receive "raw" request and response.
Browse files Browse the repository at this point in the history
The immediately pressing reason is to align on the same types that the
`processRequest` method from `graphql-upload` (aliased here as `processFileUploads`) uses.

Using the raw types should be fine as `graphql-upload` only binds to
the `response` to receive "close"-like `EventEmitter` events, and uses the
`request` side for the piping of data, which should be identical to Hapi's
abstraction.

Helps-to-land: #2844
  • Loading branch information
abernix committed Jul 30, 2019
1 parent 7638f64 commit 8e49b28
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/apollo-server-hapi/src/ApolloServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ function handleFileUploads(uploadsConfig: FileUploadOptions) {
) {
Object.defineProperty(request, 'payload', {
value: await processFileUploads(
request as any,
request.response as any,
request.raw.req,
request.raw.res,
uploadsConfig,
),
writable: false,
Expand Down

0 comments on commit 8e49b28

Please sign in to comment.