MCPcopy Create free account
hub / github.com/NativeScript/SimDeck / rewrite_metro_proxy_asset

Function rewrite_metro_proxy_asset

packages/server/src/devtools.rs:998–1012  ·  view source on GitHub ↗
(
    port: u16,
    asset_path: &str,
    content_type: Option<&str>,
    body: Vec<u8>,
)

Source from the content-addressed store, hash-verified

996}
997
998pub fn rewrite_metro_proxy_asset(
999 port: u16,
1000 asset_path: &str,
1001 content_type: Option<&str>,
1002 body: Vec<u8>,
1003) -> Vec<u8> {
1004 if !is_rewritable_metro_proxy_asset(asset_path, content_type) {
1005 return body;
1006 }
1007
1008 match String::from_utf8(body) {
1009 Ok(text) => rewrite_metro_proxy_text(port, &text).into_bytes(),
1010 Err(error) => error.into_bytes(),
1011 }
1012}
1013
1014fn is_rewritable_metro_proxy_asset(asset_path: &str, content_type: Option<&str>) -> bool {
1015 let path = asset_path

Calls 2

rewrite_metro_proxy_textFunction · 0.85