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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add options overload parameter to sendFile function #238

Closed
2 tasks done
mav-rik opened this issue Oct 2, 2021 · 2 comments 路 Fixed by #239
Closed
2 tasks done

Add options overload parameter to sendFile function #238

mav-rik opened this issue Oct 2, 2021 · 2 comments 路 Fixed by #239

Comments

@mav-rik
Copy link
Contributor

mav-rik commented Oct 2, 2021

Prerequisites

  • I have written a descriptive issue title
  • I have searched existing issues to ensure the feature has not already been requested

馃殌 Feature Proposal

Sometimes it's required to control cache headers more granularly, so it would be nice to have an option to overwrite the options while calling sendFile (just like it's already done for download).

Motivation

No response

Example

fastify.get('/path', function (req, reply) {
  return reply.sendFile('some-file.js', { maxAge: 0 })
})

fastify.get('/path/custom', function (req, reply) {
  return reply.sendFile('some-file.js', 'custom-filename.js', { maxAge: 0 })
})
@mcollina
Copy link
Member

mcollina commented Oct 2, 2021

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

@mav-rik
Copy link
Contributor Author

mav-rik commented Oct 2, 2021

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

done, new pull request #239

mcollina pushed a commit that referenced this issue Oct 5, 2021
* docs(readme): fix the 'download' method examples

* feat: add options overload parameter to sendFile

* feat: add options overload parameter to sendFile

* docs(readme): add sendMethod override options version

* fix(minor): remove default value for options from sendFile

Co-authored-by: Manuel Spigolon <behemoth89@gmail.com>

Co-authored-by: ArtemM <artemm@rvmode.com>
Co-authored-by: Manuel Spigolon <behemoth89@gmail.com>
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 a pull request may close this issue.

2 participants