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

Tests for Fastify plugins #1221

Closed
wants to merge 1 commit into from

Conversation

madflow
Copy link
Contributor

@madflow madflow commented Jan 25, 2020

This PR

  • Adds a test to check if Fastify plugins do their job when used as http server

  • Bumps Fastify to the latest version and installs fastify-helmet and fastify-compress as dev dependencies

  • The fastify-compress test is failing. It does pass when the compress middleware is used instead of the plugin

  • See Fastify plugins integration #1220

@benjie
Copy link
Member

benjie commented Jan 27, 2020

In koa we had to hack around it like this: https://github.com/graphile/postgraphile/blob/d9d5c59d106a54612fb3738003b7e631ab6d062e/src/postgraphile/http/koaMiddleware.ts#L19-L46

Maybe a similar hack would work for fastify? It might be that we should use res.send() rather than res.end() here, and then call res.end() separately?

https://github.com/graphile/postgraphile/blob/d9d5c59d106a54612fb3738003b7e631ab6d062e/src/postgraphile/http/createPostGraphileHttpRequestHandler.ts#L895

@madflow
Copy link
Contributor Author

madflow commented Jan 28, 2020

Maybe a similar hack would work for fastify? It might be that we should use res.send() rather than res.end() here, and then call res.end() separately?

I do not know unfortunatly. Regarding the res.send(): ServerResponse does not have a send method. Is there more refactoring implied or am I missing something?

@benjie
Copy link
Member

benjie commented Jan 28, 2020

Oh yeah, res.send is an Express API. We'd need to figure out what fastify compress is expecting and then use that.

@madflow madflow mentioned this pull request Apr 21, 2020
2 tasks
@benjie benjie closed this Jun 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Ancient "V5" plan
  
Awaiting triage
Development

Successfully merging this pull request may close these issues.

None yet

2 participants