1
1
/*
2
- * Copyright 2020-2022 the original author or authors.
2
+ * Copyright 2020-2023 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
@@ -58,7 +58,8 @@ public class WebGraphQlRequest extends DefaultExecutionGraphQlRequest implements
58
58
public WebGraphQlRequest (
59
59
URI uri , HttpHeaders headers , Map <String , Object > body , String id , @ Nullable Locale locale ) {
60
60
61
- super (getQuery (body ), getOperation (body ), getMap ("variables" , body ), getMap ("extensions" , body ), id , locale );
61
+ super (getQuery (body ), getOperation (body ),
62
+ getMap (VARIABLES_KEY , body ), getMap (EXTENSIONS_KEY , body ), id , locale );
62
63
63
64
Assert .notNull (uri , "URI is required'" );
64
65
Assert .notNull (headers , "HttpHeaders is required'" );
@@ -68,18 +69,18 @@ public WebGraphQlRequest(
68
69
}
69
70
70
71
private static String getQuery (Map <String , Object > body ) {
71
- Object value = body .get ("query" );
72
+ Object value = body .get (QUERY_KEY );
72
73
if (!(value instanceof String ) || !StringUtils .hasText ((String ) value )) {
73
- throw new ServerWebInputException ("Invalid value for 'query '" );
74
+ throw new ServerWebInputException ("Invalid value for '" + QUERY_KEY + " '" );
74
75
}
75
76
return (String ) value ;
76
77
}
77
78
78
79
@ Nullable
79
80
private static String getOperation (Map <String , Object > body ) {
80
- Object value = body .get ("operation" );
81
+ Object value = body .get (OPERATION_NAME_KEY );
81
82
if (value != null && !(value instanceof String )) {
82
- throw new ServerWebInputException ("Invalid value for 'operation '" );
83
+ throw new ServerWebInputException ("Invalid value for '" + OPERATION_NAME_KEY + " '" );
83
84
}
84
85
return (String ) value ;
85
86
}
0 commit comments