Skip to content

Commit

Permalink
Refine builder pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
kflansburg committed May 5, 2024
1 parent 5766930 commit d180768
Show file tree
Hide file tree
Showing 3 changed files with 140 additions and 93 deletions.
6 changes: 3 additions & 3 deletions worker-sandbox/src/counter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ impl DurableObject for Counter {
.serialize_attachment("hello")
.expect("failed to serialize attachment");

return Ok(Response::empty()
.unwrap()
return Ok(ResponseBuilder::new()
.with_status(101)
.with_websocket(Some(pair.client)));
.with_websocket(pair.client)
.empty());
}

self.count += 10;
Expand Down
2 changes: 1 addition & 1 deletion worker/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ pub use crate::queue::*;
pub use crate::r2::*;
pub use crate::request::{FromRequest, Request};
pub use crate::request_init::*;
pub use crate::response::{IntoResponse, Response, ResponseBody};
pub use crate::response::{IntoResponse, Response, ResponseBody, ResponseBuilder};
pub use crate::router::{RouteContext, RouteParams, Router};
pub use crate::schedule::*;
pub use crate::socket::*;
Expand Down
Loading

0 comments on commit d180768

Please sign in to comment.