Skip to content

make the runtime client's user agent overrideable #106

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Oct 21, 2020
Merged

make the runtime client's user agent overrideable #106

merged 4 commits into from
Oct 21, 2020

Conversation

bmoffatt
Copy link
Collaborator

Description of changes:

We use aws-lambda-cpp as a building block for other runtimes. This change lets us choose our own custom user agent for internal tracking.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@bmoffatt bmoffatt requested a review from marcomagdy October 21, 2020 18:27
src/runtime.cpp Outdated
{}

runtime::runtime(std::string const& endpoint, std::string const& user_agent)
: m_user_agent_header("User-Agent: " + user_agent + ""),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the last empty string for?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nothing, I did a bad job cleaning up from a previous revision

src/runtime.cpp Outdated
Comment on lines 160 to 164
runtime::runtime(std::string const& endpoint) : runtime(endpoint, "AWS_Lambda_Cpp/" + std::string(get_version()))
{}

runtime::runtime(std::string const& endpoint, std::string const& user_agent)
: m_user_agent_header("User-Agent: " + user_agent),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think clang-format is complaining about this.

run clang-format, or just paste the following.

runtime::runtime(std::string const& endpoint) : runtime(endpoint, "AWS_Lambda_Cpp/" + std::string(get_version())) {}

runtime::runtime(std::string const& endpoint, std::string const& user_agent)
    : m_user_agent_header("User-Agent: " + user_agent), m_endpoints{{endpoint + "/2018-06-01/runtime/init/error",
                                                                     endpoint + "/2018-06-01/runtime/invocation/next",
                                                                     endpoint + "/2018-06-01/runtime/invocation/"}},
      m_curl_handle(curl_easy_init())

@marcomagdy
Copy link
Contributor

LGTM just fix the formatting, and merge

@bmoffatt bmoffatt merged commit aa351a6 into awslabs:master Oct 21, 2020
@bmoffatt bmoffatt deleted the overrideable-user-agent branch October 21, 2020 19:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants