Skip to content

Return HttpResult<Listening> from serve() #16

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

Merged
merged 2 commits into from
Dec 7, 2015
Merged

Return HttpResult<Listening> from serve() #16

merged 2 commits into from
Dec 7, 2015

Conversation

dbrgn
Copy link
Collaborator

@dbrgn dbrgn commented Nov 24, 2015

This can be used to stop the server again, by calling the close()
method on the Listening instance.

Because Iron doesn't re-publish the Listening type, we need to add
Hyper as a dependency. See iron/iron#406.

This change allows us to add integration tests that test the server
output.

@dbrgn dbrgn changed the title WIP: Return HttpResult<Listening> from serve() Return HttpResult<Listening> from serve() Nov 24, 2015
@dbrgn
Copy link
Collaborator Author

dbrgn commented Nov 24, 2015

I also added an integration test that tests connectivity to the server.

Anyone up for a review? Finally tests again :)

@dbrgn
Copy link
Collaborator Author

dbrgn commented Dec 2, 2015

@coredump-ch/spaceapi bump :)

@dbrgn
Copy link
Collaborator Author

dbrgn commented Dec 2, 2015

The failing test is due to rust-lang/cargo#886. I'm investigating.

@dbrgn
Copy link
Collaborator Author

dbrgn commented Dec 2, 2015

The strange thing is, I cannot reproduce this locally :/

@dbrgn
Copy link
Collaborator Author

dbrgn commented Dec 2, 2015

Oops, I was on the wrong branch. Could reproduce and found the issue. We depended on an old version of Hyper.

Should be fixed now.

dbrgn added 2 commits December 2, 2015 15:26
This can be used to stop the server again, by calling the `close()`
method on the `Listening` instance.

Because Iron doesn't re-publish the `Listening` type, we need to add
Hyper as a dependency. See iron/iron#406.

This change allows us to add integration tests that test the server
output.
It starts a new server instance and verifies that a TCP connection to
it works.
let host = self.host;
let port = self.port;

let router = self.route();

println!("Starting HTTP server on http://{}:{}...", host, port);
Iron::new(router).http((host, port)).unwrap();
Iron::new(router).http((host, port))
Copy link
Member

Choose a reason for hiding this comment

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

Yay one unwrap() less ✨

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@rnestler
Copy link
Member

rnestler commented Dec 7, 2015

Good to merge 👍

dbrgn added a commit that referenced this pull request Dec 7, 2015
Return HttpResult<Listening> from serve()
@dbrgn dbrgn merged commit 61b634d into master Dec 7, 2015
@dbrgn dbrgn deleted the listening branch December 7, 2015 12:08
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.

2 participants