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

Option types not in sync with fastify-reply-from #102

Closed
gyszalai opened this issue Aug 4, 2020 · 5 comments
Closed

Option types not in sync with fastify-reply-from #102

gyszalai opened this issue Aug 4, 2020 · 5 comments

Comments

@gyszalai
Copy link
Contributor

gyszalai commented Aug 4, 2020

🐛 Bug Report

Typescript interface FastifyHttpProxyOptions does not extend FastifyReplyFromOptions from module fastify-reply-from, so it's not possible to specify e.g. the http option in fastify-http-proxy.

To Reproduce

    fastify.register(proxy, {
        upstream: upstreamUrl,
        prefix,
        http2: false,
        http: {
          requestOptions: {
            timeout: 20000
          }
        }
    })

Expected behavior

It is expected to be compiled without errors, but I get the following error:

Object literal may only specify known properties, but 'http' does not exist in type '{ upstream: string; prefix?: string | undefined; rewritePrefix?: string | undefined; http2?: boolean | undefined; proxyPayloads?: boolean | undefined; preHandler?: ((request: FastifyRequest<IncomingMessage | Http2ServerRequest, DefaultQuery, DefaultParams, DefaultHeaders, any>, reply: FastifyReply<...>, next: (err?:...'. Did you mean to write 'http2'?

Your Environment

  • node version: 14
  • fastify version: >=2.0.0
  • os: Mac
@mcollina
Copy link
Member

mcollina commented Aug 4, 2020

Would you like to send a Pull Request to address this issue? Remember to add unit tests.

@gyszalai
Copy link
Contributor Author

gyszalai commented Aug 4, 2020

Of course! Hopefully I can do it today.

@gyszalai
Copy link
Contributor Author

gyszalai commented Aug 4, 2020

@mcollina is it intentional that the http2 option is only boolean in fastify-http-proxy whereas it is Http2Options | boolean in fastify-reply-from?

@mcollina
Copy link
Member

mcollina commented Aug 4, 2020

is it intentional that the http2 option is only boolean in fastify-http-proxy whereas it is Http2Options | boolean in fastify-reply-from?

I don't think so!

gyszalai pushed a commit to gyszalai/fastify-http-proxy that referenced this issue Aug 4, 2020
@gyszalai
Copy link
Contributor Author

gyszalai commented Aug 4, 2020

OK, I'll remove the http2 option from fastify-http-proxy.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants