Skip to content

Add Server::respond #501

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

Closed
wants to merge 3 commits into from
Closed

Add Server::respond #501

wants to merge 3 commits into from

Conversation

yoshuawuyts
Copy link
Member

@yoshuawuyts yoshuawuyts commented May 14, 2020

This adds Server::respond, replacing most of the functionality provided by the http-service trait. This allows passing arbitrary requests into the server, and always get responses back out. The goal is that we remove the http-service functionality in a future PR entirely, and replace it with this method instead.

What this enables us to do is to construct requests using Surf, and then pass them into Tide without a problem:

let mut app = tide::new();
app.at("/").get(|_| async move { Ok("hello world") });

let req = surf::get("https://business.soup");
let res: surf::Response = app.respond(req).await?;

assert_eq!(res.status(), 200);

Screenshots

Screenshot_2020-05-15 tide Server - Rust

@yoshuawuyts yoshuawuyts mentioned this pull request May 15, 2020
@yoshuawuyts
Copy link
Member Author

Tests are failing locally. Closing in favor of #503

@yoshuawuyts yoshuawuyts deleted the respond branch May 17, 2020 00:44
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.

1 participant