Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,10 @@ mod moved_tests {

use parking_lot::Mutex;
use rivet_error::{MacroMarker, RivetError, RivetErrorSchema};
use rivetkit_core::HttpRequestBodyStream as CoreHttpRequestBodyStream;
use tokio::sync::{mpsc, watch};
use tracing::Level;
use tracing_subscriber::fmt::MakeWriter;

use super::{BRIDGE_RIVET_ERROR_PREFIX, HttpRequestBodyStream, parse_bridge_rivet_error};
use super::{BRIDGE_RIVET_ERROR_PREFIX, parse_bridge_rivet_error};

static AUTH_FORBIDDEN_SCHEMA: RivetErrorSchema = RivetErrorSchema {
group: "auth",
Expand Down Expand Up @@ -126,25 +124,4 @@ mod moved_tests {
assert!(logs.contains("malformed BridgeRivetErrorPayload"));
assert!(logs.contains("parse_err"));
}

#[tokio::test]
async fn cancelling_http_request_body_drops_core_receiver() {
let (body_tx, body_rx) = mpsc::channel(1);
let (_abort_tx, abort_rx) = watch::channel(None);
let stream = HttpRequestBodyStream::new(
Vec::new(),
CoreHttpRequestBodyStream::new(body_rx, abort_rx),
);

stream.cancel().await.expect("cancel request body stream");

assert!(body_tx.is_closed());
assert!(
stream
.read()
.await
.expect("read cancelled request body")
.is_none()
);
}
}
Loading