Skip to content

Commit 6dadc1c

Browse files
committed
Pass payload by value to enable moving arguments
1 parent e65c552 commit 6dadc1c

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

include/aws/lambda-runtime/runtime.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ class invocation_response {
105105
/**
106106
* Create a successful invocation response with the given payload and content-type.
107107
*/
108-
static invocation_response success(std::string const& payload, std::string const& content_type);
108+
static invocation_response success(std::string payload, std::string content_type);
109109

110110
/**
111111
* Create a failure response with the given error message and error type.

src/runtime.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -506,12 +506,12 @@ static std::string json_escape(std::string const& in)
506506
}
507507

508508
AWS_LAMBDA_RUNTIME_API
509-
invocation_response invocation_response::success(std::string const& payload, std::string const& content_type)
509+
invocation_response invocation_response::success(std::string payload, std::string content_type)
510510
{
511511
invocation_response r;
512512
r.m_success = true;
513-
r.m_content_type = content_type;
514-
r.m_payload = payload;
513+
r.m_content_type = std::move(content_type);
514+
r.m_payload = std::move(payload);
515515
return r;
516516
}
517517

0 commit comments

Comments
 (0)