Skip to content

fix(auth): Parse URL from request parts to enable wasmtime serve #4

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

Conversation

kate-goldenring
Copy link
Contributor

Spin's HTTP crate formats a uri of a request, while wasmtime does not, leaving it as solely being the path (/).

This constructs the url from the request parts rather than relying on the spin crate, making it a more universal component that can now run with wasmtime with wasmtime serve service.wasm --addr 127.0.0.1:3000

Also, removes unused arguments

Signed-off-by: Kate Goldenring <kate.goldenring@fermyon.com>
Copy link
Member

@michelleN michelleN left a comment

Choose a reason for hiding this comment

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

manually tested with Spin 🎉

.ok_or(anyhow::anyhow!("missing host header"))?;
let host = String::from_utf8_lossy(header);
let path = request.path_with_query().unwrap_or_default();
let full = format!("http://{}{}", host, path);
Copy link
Member

Choose a reason for hiding this comment

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

We might want to consider not hardcoding scheme in the future.

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