Skip to main content

GraphQL

Source file: examples/graphql_protocol.hen

What It Demonstrates

  • protocol = graphql
  • operation and variables directives
  • ~~~graphql request bodies
  • graphql.data... selectors

Key Pattern

protocol = graphql
POST {{ GQL_ORIGIN }}
operation = GetUser
variables = {"getUserId":"abc1234"}

~~~graphql
query GetUser($getUserId: String) {
getUser(id: $getUserId) {
id
name
}
}
~~~

Run It

hen verify ./examples/graphql_protocol.hen
hen run ./examples/graphql_protocol.hen 0 --non-interactive

What To Notice

  • GraphQL still executes over HTTP, so status, headers, and ordinary body access remain available.
  • Successful responses may omit errors entirely, so graphql.data... is the most stable selector for positive assertions.

Related reference: Protocols