MCPcopy Create free account
hub / github.com/LukeMathWalker/biscotti / process_outgoing

Method process_outgoing

src/processor.rs:78–97  ·  view source on GitHub ↗

Transform a [`ResponseCookie`] before it is sent to the client.

(&self, mut cookie: ResponseCookie<'c>)

Source from the content-addressed store, hash-verified

76impl Processor {
77 /// Transform a [`ResponseCookie`] before it is sent to the client.
78 pub fn process_outgoing<'c>(&self, mut cookie: ResponseCookie<'c>) -> ResponseCookie<'c> {
79 if self.percent_encode {
80 let name = encode(&cookie.name).to_string();
81 cookie.name = name.into();
82 }
83 if let Some(rule) = self.rules.get(cookie.name.as_ref()) {
84 let value = rule.primary.process_outgoing(&cookie.name, &cookie.value);
85 cookie.value = value.into();
86 } else {
87 // We don't need to percent-encode the value if we're encrypting or signing it.
88 // The signing/encryption process is guaranteed to return a value that is safe to use
89 // in a cookie.
90 if self.percent_encode {
91 let value = encode(&cookie.value).to_string();
92 cookie.value = value.into();
93 }
94 }
95
96 cookie
97 }
98
99 /// Returns `true` if a cookie with the given name will be encrypted before
100 /// being sent back to the client in the response.

Callers 6

roundtrip_encryptionFunction · 0.80
roundtrip_signingFunction · 0.80
roundtrip_encodedFunction · 0.80
header_valuesMethod · 0.80

Calls 5

encodeFunction · 0.85
as_refMethod · 0.80
encryptMethod · 0.80
signMethod · 0.80
getMethod · 0.45

Tested by 5

roundtrip_encryptionFunction · 0.64
roundtrip_signingFunction · 0.64
roundtrip_encodedFunction · 0.64