mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-08-29 03:06:45 +08:00
Re-order route registration for GraphQL web endpoints
Re-order the route registrations for GraphQL requests so that the most commonly matched path is evaluated first. Closes gh-39613
This commit is contained in:
parent
1e45d5cfa2
commit
057432c87b
@ -112,8 +112,8 @@ public class GraphQlWebFluxAutoConfiguration {
|
||||
String path = properties.getPath();
|
||||
logger.info(LogMessage.format("GraphQL endpoint HTTP POST %s", path));
|
||||
RouterFunctions.Builder builder = RouterFunctions.route();
|
||||
builder = builder.GET(path, this::onlyAllowPost);
|
||||
builder = builder.POST(path, SUPPORTS_MEDIATYPES, httpHandler::handleRequest);
|
||||
builder = builder.GET(path, this::onlyAllowPost);
|
||||
if (properties.getGraphiql().isEnabled()) {
|
||||
GraphiQlHandler graphQlHandler = new GraphiQlHandler(path, properties.getWebsocket().getPath());
|
||||
builder = builder.GET(properties.getGraphiql().getPath(), graphQlHandler::handleRequest);
|
||||
|
@ -112,9 +112,9 @@ public class GraphQlWebMvcAutoConfiguration {
|
||||
String path = properties.getPath();
|
||||
logger.info(LogMessage.format("GraphQL endpoint HTTP POST %s", path));
|
||||
RouterFunctions.Builder builder = RouterFunctions.route();
|
||||
builder = builder.GET(path, this::onlyAllowPost);
|
||||
builder = builder.POST(path, RequestPredicates.contentType(MediaType.APPLICATION_JSON)
|
||||
.and(RequestPredicates.accept(SUPPORTED_MEDIA_TYPES)), httpHandler::handleRequest);
|
||||
builder = builder.GET(path, this::onlyAllowPost);
|
||||
if (properties.getGraphiql().isEnabled()) {
|
||||
GraphiQlHandler graphiQLHandler = new GraphiQlHandler(path, properties.getWebsocket().getPath());
|
||||
builder = builder.GET(properties.getGraphiql().getPath(), graphiQLHandler::handleRequest);
|
||||
|
Loading…
Reference in New Issue
Block a user