Skip to content
This repository has been archived by the owner on Jan 19, 2022. It is now read-only.

Fix known issues: Tutorial 'Write HTTP clients & servers' doesn't workk as expected #63

Merged
merged 3 commits into from
Sep 28, 2020

Conversation

Classy-Bear
Copy link
Contributor

The issue was opened here. The server finally ends (closes) the response(s). The file is served as it says in the tutorial.

@googlebot
Copy link

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 @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

@Classy-Bear
Copy link
Contributor Author

@googlebot I signed it!

@googlebot
Copy link

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

David Acevedo added 2 commits September 26, 2020 01:56
The wrong indentation was caused by VIM.
@kwalrath
Copy link
Contributor

I can't see the difference... Can you tell me what changed?

@Classy-Bear
Copy link
Contributor Author

Sure! The response wasn't being closed, since it wasn't being reached because of the if/else statement.

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.

@kwalrath
Copy link
Contributor

Thanks! I missed that it had moved outside the braces.

@kwalrath kwalrath merged commit 9349238 into dart-archive:master Sep 28, 2020
@stevenanthonyrevo
Copy link

@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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Development

Successfully merging this pull request may close these issues.

4 participants