spinframework / spinframework/spin-rust-sdk
Misleading docs on P3 resurfaced `http::Response::new()`
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 35
- Forks
- 23
- Avg merge
- 37m
- Merged PRs (30d)
- 1
Description
Create the following Spin SDK P3 handler:
#[spin_sdk::http_wasip3::http_service]
async fn handle(_request: Request) -> impl IntoResponse {
spin_sdk::http_wasip3::Response::new("done\n")
}
Rust gets mad at you:
Scroll down the docs to see what you are allowed to pass to new and:
It's confusing that the docs show an example of passing an &str but you're not actually allowed to. Unfortunately the Response type is a re-export so we don't control the docs.
Amusingly, you can return an &str directly...
#[spin_sdk::http_wasip3::http_service]
async fn handle(_request: Request) -> impl IntoResponse {
"done\n"
}
...you just can't use one in a Response.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the P3 handler example and the documentation for spin_sdk::http_wasip3::Response::new, then verify where the re-exported Response documentation is generated or maintained. Done means the documented argument matches what the example accepts, or the example no longer presents an invalid &str usage.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100