Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion sdk/cosmos/azure_data_cosmos/src/pipeline/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ impl CosmosPipeline {

// NOTE: Offers API doesn't allow Enable Content Response On Write to be false, so once we support that option, we'll need to ignore it here.
let offer_link =
ResourceLink::root(ResourceType::Offers).item(&current_throughput.offer_id);
ResourceLink::root(ResourceType::Offers).item_by_rid(&current_throughput.offer_id);
let mut req = Request::new(self.url(&offer_link), Method::Put);
req.insert_headers(&ContentType::APPLICATION_JSON)?;
req.set_json(&current_throughput)?;
Expand Down
27 changes: 26 additions & 1 deletion sdk/cosmos/azure_data_cosmos/src/pipeline/signature_target.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ impl<'a> SignatureTarget<'a> {
_ => "extension",
},
self.link.resource_type().path_segment(),
self.link.resource_link(),
self.link.link_for_signing(),
self.date_string,
)
}
Expand Down Expand Up @@ -97,6 +97,31 @@ colls
dbs/MyDatabase/colls/MyCollection
mon, 01 jan 1900 01:00:00 gmt

"
);
}

#[test]
fn into_signable_string_does_not_url_encode_rid_links() {
let time_nonce = time::parse_rfc3339("1900-01-01T01:00:00.000000000+00:00").unwrap();
let date_string = time::to_rfc7231(&time_nonce).to_lowercase();

let ret = SignatureTarget::new(
Method::Get,
&ResourceLink::root(ResourceType::Databases)
.item_by_rid("ABCDEF==")
.feed(ResourceType::Containers)
.item_by_rid("XYZ123+="),
&date_string,
)
.into_signable_string();
assert_eq!(
ret,
"get
colls
dbs/ABCDEF==/colls/XYZ123+=
mon, 01 jan 1900 01:00:00 gmt

"
);
}
Expand Down
Loading