-
Notifications
You must be signed in to change notification settings - Fork 4
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
Conversation
I also added an integration test that tests connectivity to the server. Anyone up for a review? Finally tests again :) |
@coredump-ch/spaceapi bump :) |
The failing test is due to rust-lang/cargo#886. I'm investigating. |
The strange thing is, I cannot reproduce this locally :/ |
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. |
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)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yay one unwrap()
less ✨
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✨
Good to merge 👍 |
Return HttpResult<Listening> from serve()
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 addHyper as a dependency. See iron/iron#406.
This change allows us to add integration tests that test the server
output.