From 92ffc6a60d186a4b61389002dbc00b2147d6a5ca Mon Sep 17 00:00:00 2001 From: Jared Henderson Date: Fri, 13 Aug 2021 14:07:42 -0400 Subject: [PATCH] allow customization of POST stream strategy --- Sources/GraphQLKit/Graphiti+Router.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/GraphQLKit/Graphiti+Router.swift b/Sources/GraphQLKit/Graphiti+Router.swift index 4e1724f..46dbb33 100644 --- a/Sources/GraphQLKit/Graphiti+Router.swift +++ b/Sources/GraphQLKit/Graphiti+Router.swift @@ -3,8 +3,8 @@ import Graphiti import GraphQL extension RoutesBuilder { - public func register(graphQLSchema schema: Schema, withResolver rootAPI: RootType, at path: PathComponent="graphql") { - self.post(path) { (request) -> EventLoopFuture in + public func register(graphQLSchema schema: Schema, withResolver rootAPI: RootType, at path: PathComponent="graphql", postBodyStreamStrategy: HTTPBodyStreamStrategy = .collect) { + self.on(.POST, path, body: postBodyStreamStrategy) { (request) -> EventLoopFuture in try request.resolveByBody(graphQLSchema: schema, with: rootAPI) .flatMap({ $0.encodeResponse(status: .ok, for: request)