Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass HTTP request to ctx function in Graphql_lwt.Server.start #88

Merged
merged 1 commit into from
Apr 14, 2018

Conversation

andreas
Copy link
Owner

@andreas andreas commented Apr 14, 2018

This PR changes the type of Graphql_lwt.Server.start:

(* Before this PR *)
val start : ?port:int -> ctx:(unit -> 'ctx) -> 'ctx Schema.schema -> unit Lwt.t

(* After this PR *)
val start : ?port:int -> ctx:(Cohttp.Request.t -> 'ctx) -> 'ctx Schema.schema -> unit Lwt.t

This allows library users to construct a context that depends on the incoming HTTP request, e.g. cookies, headers, etc. Related to https://github.com/andreas/ocaml-graphql-server/issues/43#issuecomment-378058396.

@andreas andreas merged commit 75bb71c into master Apr 14, 2018
@andreas andreas deleted the graphql-lwt-better-ctx-function branch April 14, 2018 08:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant