MCPcopy Create free account
hub / github.com/apache/arrow / SetMetadataInRequest

Method SetMetadataInRequest

cpp/src/arrow/filesystem/s3fs.cc:1681–1705  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1679
1680 template <typename ObjectRequest>
1681 Status SetMetadataInRequest(ObjectRequest* request) {
1682 std::shared_ptr<const KeyValueMetadata> metadata;
1683
1684 if (metadata_ && metadata_->size() != 0) {
1685 metadata = metadata_;
1686 } else if (default_metadata_ && default_metadata_->size() != 0) {
1687 metadata = default_metadata_;
1688 }
1689
1690 bool is_content_type_set{false};
1691 if (metadata) {
1692 RETURN_NOT_OK(SetObjectMetadata(metadata, request));
1693
1694 is_content_type_set = metadata->Contains("Content-Type");
1695 }
1696
1697 if (!is_content_type_set) {
1698 // If we do not set anything then the SDK will default to application/xml
1699 // which confuses some tools (https://github.com/apache/arrow/issues/11934)
1700 // So we instead default to application/octet-stream which is less misleading
1701 request->SetContentType("application/octet-stream");
1702 }
1703
1704 return Status::OK();
1705 }
1706
1707 std::shared_ptr<ObjectOutputStream> Self() {
1708 return std::dynamic_pointer_cast<ObjectOutputStream>(shared_from_this());

Callers

nothing calls this directly

Calls 4

SetObjectMetadataFunction · 0.85
OKFunction · 0.50
sizeMethod · 0.45
ContainsMethod · 0.45

Tested by

no test coverage detected