Skip to content

Commit 37445da

Browse files
authored
Merge pull request #2 from denvned/patch-1
Fix a pair of NPEs in doGet
2 parents d755620 + 2dea4e6 commit 37445da

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/main/java/graphql/servlet/GraphQLServlet.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,12 @@ public void setVariables(String variables) {
177177
@Override
178178
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
179179
GraphQLContext context = createContext(Optional.of(req), Optional.of(resp));
180-
if (req.getPathInfo().contentEquals("/schema.json")) {
181-
query(CharStreams.toString(new InputStreamReader(getClass().getResourceAsStream("introspectionQuery"))), new HashMap<>(), schema, req, resp, context);
180+
String path = req.getPathInfo();
181+
if (path == null) {
182+
path = req.getServletPath();
183+
}
184+
if (path.contentEquals("/schema.json")) {
185+
query(CharStreams.toString(new InputStreamReader(GraphQLServlet.class.getResourceAsStream("introspectionQuery"))), new HashMap<>(), schema, req, resp, context);
182186
} else {
183187
query(req.getParameter("q"), new HashMap<>(), readOnlySchema, req, resp, context);
184188
}

0 commit comments

Comments
 (0)