Chihwei
Chihwei
CDCloudflare Developers
Created by Chihwei on 9/16/2024 in #general-help
How to Connect to Warp+ Paid Subscription on Linux?
No description
2 replies
CDCloudflare Developers
Created by Chihwei on 6/18/2024 in #workers-help
worker-rs: http hello world
use worker::*;

#[event(fetch)]
async fn fetch(
_req: HttpRequest,
_env: Env,
_ctx: Context,
) -> Result<HttpResponse> {
console_error_panic_hook::set_once();
Ok(http::Response::builder()
.status(http::StatusCode::OK)
.body(Body::empty())?)
}
use worker::*;

#[event(fetch)]
async fn fetch(
_req: HttpRequest,
_env: Env,
_ctx: Context,
) -> Result<HttpResponse> {
console_error_panic_hook::set_once();
Ok(http::Response::builder()
.status(http::StatusCode::OK)
.body(Body::empty())?)
}
How can I put a simple string into the body? Tried many ways but didn't work. The body seems to be only accepting a stream. (http feature flag enabled for worker-rs)
8 replies