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

Compare flags.cache to the string '0', not 0 #298

Closed
wants to merge 1 commit into from

Conversation

jeffposnick
Copy link

The logic in #245 is faulty, as flags is set via

const flags = args.parse(process.argv, { minimist })

and that will assign a string representation of all of the flag values.

This PR updates the code to handle -c 0 by doing the comparison against the string '0' instead of the number 0, to account for the fact that flags.cache is a string.

@jeffposnick
Copy link
Author

Actually, my mistake. -c 0 should be working properly in master already.

I was thrown because of that flags.cache === 0 check, which I don't think is every going to be true... but the initial check of flags.cache will be true, since '0' is a true value, so I don't think that other clause will ever be triggered.

So maxAge=0 is being set, but that whole Cache-Control: no-cache introduced in https://github.com/zeit/serve/pull/245/files isn't being set. They have similar effects, though.

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