gproxy_transform/transform/
context.rs1use crate::protocol::OperationKey;
2
3#[derive(Debug, Clone, PartialEq, Eq)]
11pub struct TransformContext {
12 pub source: OperationKey,
13 pub target: OperationKey,
14 pub path: String,
15 pub query: Option<String>,
16}
17
18impl TransformContext {
19 pub fn new(source: OperationKey, target: OperationKey) -> Self {
20 Self {
21 source,
22 target,
23 path: String::new(),
24 query: None,
25 }
26 }
27
28 pub fn with_request(mut self, path: &str, query: Option<&str>) -> Self {
30 self.path = path.to_owned();
31 self.query = query.map(str::to_owned);
32 self
33 }
34}