Use post for ref patch and serialize (#1192)

This commit is contained in:
Ken Loeffler
2026-01-19 14:44:42 -08:00
committed by GitHub
parent d08780fc14
commit 02b41133f8
6 changed files with 98 additions and 59 deletions

View File

@@ -1,5 +1,4 @@
use std::{
fmt::Write as _,
fs,
path::{Path, PathBuf},
process::Command,
@@ -13,8 +12,12 @@ use rbx_dom_weak::types::Ref;
use tempfile::{tempdir, TempDir};
use librojo::web_api::{
ReadResponse, SerializeResponse, ServerInfoResponse, SocketPacket, SocketPacketType,
use librojo::{
web_api::{
ReadResponse, SerializeRequest, SerializeResponse, ServerInfoResponse, SocketPacket,
SocketPacketType,
},
SessionId,
};
use rojo_insta_ext::RedactionMap;
@@ -226,16 +229,19 @@ impl TestServeSession {
}
}
pub fn get_api_serialize(&self, ids: &[Ref]) -> Result<SerializeResponse, reqwest::Error> {
let mut id_list = String::with_capacity(ids.len() * 33);
for id in ids {
write!(id_list, "{id},").unwrap();
}
id_list.pop();
pub fn get_api_serialize(
&self,
ids: &[Ref],
session_id: SessionId,
) -> Result<SerializeResponse, reqwest::Error> {
let client = reqwest::blocking::Client::new();
let url = format!("http://localhost:{}/api/serialize", self.port);
let body = serde_json::to_string(&SerializeRequest {
session_id,
ids: ids.to_vec(),
});
let url = format!("http://localhost:{}/api/serialize/{}", self.port, id_list);
reqwest::blocking::get(url)?.json()
client.post(url).body((body).unwrap()).send()?.json()
}
}

View File

@@ -646,7 +646,7 @@ fn meshpart_with_id() {
.unwrap();
let serialize_response = session
.get_api_serialize(&[*meshpart, *objectvalue])
.get_api_serialize(&[*meshpart, *objectvalue], info.session_id)
.unwrap();
// We don't assert a snapshot on the SerializeResponse because the model includes the
@@ -673,7 +673,9 @@ fn forced_parent() {
read_response.intern_and_redact(&mut redactions, root_id)
);
let serialize_response = session.get_api_serialize(&[root_id]).unwrap();
let serialize_response = session
.get_api_serialize(&[root_id], info.session_id)
.unwrap();
assert_eq!(serialize_response.session_id, info.session_id);