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

Method SetMetadataInRequest

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

Source from the content-addressed store, hash-verified

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