Fix known issues: Tutorial 'Write HTTP clients & servers' doesn't workk as expected#63
Conversation
…k as expected #2646
|
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed (or fixed any issues), please reply here with What to do if you already signed the CLAIndividual signers
Corporate signers
ℹ️ Googlers: Go here for more info. |
|
@googlebot I signed it! |
|
CLAs look good, thanks! ℹ️ Googlers: Go here for more info. |
The wrong indentation was caused by VIM.
|
I can't see the difference... Can you tell me what changed? |
|
Sure! The response wasn't being closed, since it wasn't being reached because of the We had this: if (await targetFile.exists()) {
...
} else {
...
await req.response.close();
}If the file exists the response will not be closed because the else statement will not be executed. So I take out the line where the response is being closed and put it outside the else statement: if (await targetFile.exists()) {
...
} else {
...
}
await req.response.close();So now matter what happen the response will be closed. If the response is not closed, the response will hang and no file will be served. |
|
Thanks! I missed that it had moved outside the braces. |
|
@kwalrath, I am sorry but I think there is a misunderstanding. The original pull request was here, more specifically here, if there were questions or concerns, I should have received a review? No worries, looks like the problem is solved already. But you are missing a few changes, I suggested in my PR. |
The issue was opened here. The server finally ends (closes) the response(s). The file is served as it says in the tutorial.