← Back to context

Comment by singularity2001

4 days ago

Ok(Response::new_html(StatusCode::OK, Body::fixed(rendered)))

no thank you. if you like it good for you, for me this looks worse than

Body body = BodyFactory.newInstance(BodyConfiguration.OK)

which is still SHORTHER and less cancer

Your BodyFactory example isn't even functionally the same as the quoted code snippet. Nowhere is the Body::fixed(rendered) equivalent seen, for example.

That's one of the issues explicitly mentioned in the article ("Request Handler API is far from being ergonomic"). This will get better in the nearest future as it's a major pain point, I'm just thinking of the best API for doing request/responses.