You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opendal.apache.org by "suyanhanx (via GitHub)" <gi...@apache.org> on 2023/04/22 10:22:58 UTC
[GitHub] [incubator-opendal] suyanhanx commented on a diff in pull request #2067: feat(core): test for read_with_override_content_composition
suyanhanx commented on code in PR #2067:
URL: https://github.com/apache/incubator-opendal/pull/2067#discussion_r1174363475
##########
core/tests/behavior/write.rs:
##########
@@ -580,6 +581,36 @@ pub async fn test_read_with_special_chars(op: Operator) -> Result<()> {
Ok(())
}
+pub async fn test_read_with_override_content_disposition(op: Operator) -> Result<()> {
+ if op.info().can_read_with_override_content_disposition() {
+ let path = uuid::Uuid::new_v4().to_string();
+ let (content, _) = gen_bytes();
+
+ op.write(&path, content.clone())
+ .await
+ .expect("write must succeed");
+
+ let target_content_disposition = "attachment; filename=foo.txt";
+
+ let op_read = OpRead::default();
+ op_read.with_override_content_disposition(target_content_disposition.clone());
+
+ let mut reader = op.reader_with(&path, op_read)
+ .await
+ .expect("reader must succeed");
+
+ let mut buf = Vec::new();
+ reader.read_to_end(&mut buf).await?;
+
+ assert_eq!(buf, content);
+ assert_eq!(reader.content_disposition(), Some("attachment; filename=foo.txt"));
Review Comment:
There is no such method to get metadata for now.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org