Skip to content

Commit

Permalink
Merge branch 'main' of github.com:coratgerl/wobe
Browse files Browse the repository at this point in the history
  • Loading branch information
coratgerl committed Jun 9, 2024
2 parents 7c8c6c0 + 22daccf commit fdbbbc0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 4 additions & 0 deletions packages/wobe-graphql-yoga/src/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,16 @@ describe('Wobe GraphQL Yoga plugin', () => {
Query: {
hello: (_, __, context) => {
context.response.setCookie('tata', 'tata')
expect(context.test).toBeDefined()
expect(context.response).toBeDefined()
expect(context.request.headers).toBeDefined()
return 'Hello from Yoga!'
},
},
},
context: () => {
return { test: 'test' }
},
}),
)

Expand Down
6 changes: 4 additions & 2 deletions packages/wobe-graphql-yoga/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ import {
createYoga,
type GraphQLSchemaWithContext,
type YogaServerOptions,
type YogaInitialContext,
} from 'graphql-yoga'
import type { MaybePromise, Wobe, WobePlugin, WobeResponse } from 'wobe'

export type GraphqlYogaContext =
| MaybePromise<Record<string, unknown>>
| ((initialContext: YogaInitialContext) => MaybePromise<unknown>)
| ((context: {
request: Request
response: WobeResponse
}) => MaybePromise<unknown>)

export interface GraphqlYogaPluginOptions {
graphqlMiddleware?: (
Expand Down

0 comments on commit fdbbbc0

Please sign in to comment.