File tree Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -15,7 +15,11 @@ import { parse } from 'graphql';
1515 * @param {TypeWeightObject } typeWeights
1616 * @param {string } complexityOption
1717 */
18- function getQueryTypeComplexity ( queryString : string , typeWeights : TypeWeightObject ) : number {
18+ function getQueryTypeComplexity (
19+ queryString : string ,
20+ queryVariables : any ,
21+ typeWeights : TypeWeightObject
22+ ) : number {
1923 throw Error ( 'getQueryComplexity is not implemented.' ) ;
2024}
2125
Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ export function expressRateLimiter(
4242 // return the rate limiting middleware
4343 return async ( req : Request , res : Response , next : NextFunction ) : Promise < void > => {
4444 const requestTimestamp = new Date ( ) . valueOf ( ) ;
45- const { query } : { query : string } = req . body ;
45+ const { query, variables } : { query : string ; variables : any } = req . body ;
4646 if ( ! query ) {
4747 // FIXME: Throw an error here? Code currently passes this on to whatever is next
4848 console . log ( 'There is no query on the request' ) ;
@@ -62,7 +62,7 @@ export function expressRateLimiter(
6262 const ip : string = req . ips [ 0 ] || req . ip ;
6363
6464 // FIXME: this will only work with type complexity
65- const queryComplexity = getQueryTypeComplexity ( query , typeWeightObject ) ;
65+ const queryComplexity = getQueryTypeComplexity ( query , variables , typeWeightObject ) ;
6666
6767 try {
6868 // process the request and conditinoally respond to client with status code 429 o
You can’t perform that action at this time.
0 commit comments