Skip to content

Commit

Permalink
add FileSpec ctor to Connector
Browse files Browse the repository at this point in the history
  • Loading branch information
ibell13 committed Jan 21, 2025
1 parent 241f950 commit c41349c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
12 changes: 12 additions & 0 deletions io/private/connector/Connector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,18 @@ Connector::Connector(const std::string& filename, const StringMap& headers,
}
}

Connector::Connector(const FileSpec& spec) :
m_arbiter(new arbiter::Arbiter),
m_headers(spec.m_headers),
m_query(spec.m_query),
m_filename(spec.m_path.string())
{
if (m_headers.find("User-Agent") == m_headers.end())
{
m_headers.insert( std::make_pair("User-Agent", getUserAgent()));
}
}


std::string Connector::get(const std::string& path) const
{
Expand Down
1 change: 1 addition & 0 deletions io/private/connector/Connector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ class Connector
Connector();
Connector(const std::string& filename, const StringMap& headers, const StringMap& query);
Connector(const StringMap& headers, const StringMap& query);
Connector(const FileSpec& spec);

std::string get(const std::string& path) const;
NL::json getJson(const std::string& path) const;
Expand Down

0 comments on commit c41349c

Please sign in to comment.