poem icon indicating copy to clipboard operation
poem copied to clipboard

Redirect response type error

Open brussee opened this issue 8 months ago • 1 comments

How should a redirect be done with poem_openapi?

Error: poem::Response and poem_openapi::payload::Response<()> have similar names, but are actually distinct types

In:

#[poem_openapi::OpenApi]
impl IndexApi {
    #[oai(path = "/", method = "get")]
    async fn index(&self) -> poem::Result<poem_openapi::payload::Response<()>> {
        Ok(poem::IntoResponse::into_response(
            poem::web::Redirect::see_other("http://127.0.0.1:3000/api/v1/swagger"),
        ))
    }
}

brussee avatar Jun 01 '24 16:06 brussee