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

Fix backend header set twice #61

Merged
merged 1 commit into from
Dec 21, 2022
Merged

Fix backend header set twice #61

merged 1 commit into from
Dec 21, 2022

Conversation

atxr
Copy link
Contributor

@atxr atxr commented Dec 11, 2022

@atxr atxr added the bug Something isn't working label Dec 11, 2022
@atxr atxr added this to the iScsc blog v0.2.0 milestone Dec 11, 2022
@atxr atxr requested review from amtoine and ctmbl December 11, 2022 23:11
@atxr atxr self-assigned this Dec 11, 2022
Copy link
Contributor

@ctmbl ctmbl left a comment

Choose a reason for hiding this comment

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

Didn't test it but seems quite logic.
If you tested it right we can merge it 👍

@ctmbl ctmbl requested a review from gbrivady December 12, 2022 01:46
@ctmbl ctmbl added Priority: Medium The Issue must be addressed as soon as possible Severity: Trivial The bug or Issue doesn't impact the user, is about esthetics or making things clean labels Dec 12, 2022
Copy link
Member

@amtoine amtoine left a comment

Choose a reason for hiding this comment

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

as @ctmbl said, if you tested it, i'm fine with this 😌

just a question, and i'll approve

what is the new return supposed to do? 🤔
it only prevents the bug in #60 while keeping the rest of the website intact? 😮

@atxr
Copy link
Contributor Author

atxr commented Dec 21, 2022

@amtoine
The function res.status or res.sendStatus can be used only once in a route. It basically sets the response headers.
Here, without this return, this function might set the headers to 404 once and then still execute the remaining code, which will set the headers again at the end.
So this return allows to quit the function when no author is provided.

Copy link
Member

@amtoine amtoine left a comment

Choose a reason for hiding this comment

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

The function res.status or res.sendStatus can be used only once in a route. It basically sets the response headers.
Here, without this return, this function might set the headers to 404 once and then still execute the remaining code, which will set the headers again at the end.
So this return allows to quit the function when no author is provided.

ok that makes total sense, thanks for the precision 😌

then it's great imo 👍

@amtoine
Copy link
Member

amtoine commented Dec 21, 2022

again, waiting a bit for @gbrivady 😋
@atxr, if you feel time has passed enough, just merge this 😉

@atxr
Copy link
Contributor Author

atxr commented Dec 21, 2022

Shouldn't we wait for #66 before merging this one?

@amtoine
Copy link
Member

amtoine commented Dec 21, 2022

Shouldn't we wait for #66 before merging this one?

imo, this is a bug fix so, even if it was not planned in the 0.1.1, it still is a bug fix and thus could go inside this patch version ... or after

in the end, that does not look like a big deal at all 😉

Copy link
Member

@gbrivady gbrivady left a comment

Choose a reason for hiding this comment

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

Seems fine to me

@amtoine amtoine merged commit 37de8c4 into iScsc:main Dec 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Priority: Medium The Issue must be addressed as soon as possible Severity: Trivial The bug or Issue doesn't impact the user, is about esthetics or making things clean
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Error HTTP Headers already set
4 participants