Configure allowed HTTP methods in GraphQL transports

This commit adds new "spring.graphql.http.methods" and
"spring.graphql.http.sse.methods" configuration properties that let you
configure the allowed HTTP methods for the given transports.

Closes gh-51732
This commit is contained in:
Brian Clozel
2026-09-14 12:00:40 +02:00
parent 8798aa6350
commit 8b22099f77
7 changed files with 195 additions and 31 deletions
@@ -96,6 +96,9 @@ The GraphQL HTTP endpoint is at HTTP POST `/graphql` by default.
It also supports the `"text/event-stream"` media type over Server Sent Events for subscriptions only.
The path can be customized with configprop:spring.graphql.http.path[].
By default, the HTTP transport only allows HTTP POST requests but this can be configured with configprop:spring.graphql.http.methods[]
and configprop:spring.graphql.http.sse.methods[], see {url-spring-graphql-docs}/transports.html[the transports section of the Spring GraphQL documentation] for more.
TIP: The HTTP endpoint for both Spring MVC and Spring WebFlux is provided by a `RouterFunction` bean with an javadoc:org.springframework.core.annotation.Order[format=annotation] of `0`.
If you define your own `RouterFunction` beans, you may want to add appropriate javadoc:org.springframework.core.annotation.Order[format=annotation] annotations to ensure that they are sorted correctly.