MCPcopy Create free account
hub / github.com/bajrangCoder/setu / compact_storage

Method compact_storage

src/entities/response.rs:340–369  ·  view source on GitHub ↗

Drop redundant raw bytes for text-like responses and recompute cached metadata.

(&mut self)

Source from the content-addressed store, hash-verified

338 (
339 String::from_utf8_lossy(&body_bytes).into_owned(),
340 Bytes::new(),
341 )
342 } else {
343 (String::new(), body_bytes)
344 };
345
346 let mut response = Self {
347 status_code,
348 status_text,
349 headers,
350 request_headers: HashMap::new(),
351 request_url: String::new(),
352 payload: ResponsePayload {
353 body: Arc::from(body),
354 body_bytes: stored_body_bytes,
355 ..ResponsePayload::default()
356 },
357 body_size_bytes,
358 duration_ms,
359 content_type,
360 };
361 response.compact_storage();
362 response
363 }
364
365 pub fn with_request_meta(
366 mut self,
367 url: impl Into<String>,
368 request_headers: HashMap<String, String>,
369 ) -> Self {
370 self.request_url = url.into();
371 self.request_headers = request_headers;
372 self

Callers 2

newMethod · 0.80
load_from_fileMethod · 0.80

Calls 3

is_emptyMethod · 0.45
clearMethod · 0.45
lenMethod · 0.45

Tested by

no test coverage detected