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

A few bugfixes #97

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open

Conversation

ironswordX-dev
Copy link

I was trying to use the cookie parser module, but I realized it was making all requests to my site to just be stuck waiting for the server response, and I found there were a few bugs in the code. I fixed them in this pull request, though.

Fixed an issue where if no cookies are found, the function would return the `next` function value instead of calling the `next` function
Add a ! sign to the first check so that it only exits the function if the cookies don't exist, since undefined/null is a falsely value
Copy link
Contributor

@dougwilson dougwilson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks so much! Sorry about your issue. To help ensure this doesn't reoccur and it is functioning as we make changes, please add tests that only pass with your bug fix.

@ironswordX-dev
Copy link
Author

ironswordX-dev commented Sep 9, 2023

What tests?

remove the ! I added from the last commit, and default req.cookies to an empty JSON value when there are no cookies
@dougwilson
Copy link
Contributor

What tests?

So you said there is a bug, and this is a fix. So we have a file under the tests folder with tests to make sure the module works every time we change something. If you fix a bug but don't add any tests, we are likely to break your bug fix on accident.

A test would reproduce the behavior that is causing this module to sit and wait forever as your description states, for example.

If you are not sure how to do this, we can help. Just provide an app and instructions for how to reproduce the hanging behavior you are seeing and we can help make that in to a test.

@ironswordX-dev
Copy link
Author

What tests?

So you said there is a bug, and this is a fix. So we have a file under the tests folder with tests to make sure the module works every time we change something. If you fix a bug but don't add any tests, we are likely to break your bug fix on accident.

A test would reproduce the behavior that is causing this module to sit and wait forever as your description states, for example.

If you are not sure how to do this, we can help. Just provide an app and instructions for how to reproduce the hanging behavior you are seeing and we can help make that in to a test.

Ok

@ironswordX-dev
Copy link
Author

Also, most of the GitHub tests failed, but most of the 1x.x errors is because I did not put a space at the beginning of a comment

image

@dougwilson
Copy link
Contributor

Also, most of the GitHub tests failed, but most of the 1x.x errors is because I did not put a space at the beginning of a comment

I see, it is not the tests failing, but the lint check. This is just bc it checks to make sure the code is styled correctly. You can run npm run lint locally to see the code formatting issue to correct those.

@ironswordX-dev
Copy link
Author

I was actually just editing it straight from GitHub 😁

was for testing, but is no longer needed
Copy link
Member

@UlisesGascon UlisesGascon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this PR @ironswordX-dev!

I have some notes about the changes requested:

  • Minimum Node.js version supported currently is Node 0.8, so ES6 is not supported
  • I am not sure what are the bugs solved on this PR, can you provide more context (or even tests) to help us understand it better?

Thanks a lot in advance!

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

Successfully merging this pull request may close these issues.

4 participants