【发布时间】:2018-06-13 19:51:02
【问题描述】:
当我使用 AWS Mobile hub 进行云逻辑集成时。
如何将数据发送到 lambda 函数?
代码:
public void postCloudLogic(String mName,String mClass) {
// Create components of api request
final String method = "POST";
final String path = "/test_rds_lambda/?name="+mName+"&class="+mClass;
final String body = "";
final byte[] content = body.getBytes(StringUtils.UTF8);
final Map parameters = new HashMap<>();
parameters.put("lang", "en_US");
final Map headers = new HashMap<>();
// Use components to create the api request
ApiRequest localRequest =
new ApiRequest(apiClient.getClass().getSimpleName())
.withPath(path)
.withHttpMethod(HttpMethodName.valueOf(method))
.withHeaders(headers)
.addHeader("Content-Type", "application/json")
.withParameters(parameters);
...
如你所见,我使用过:
final String path = "/test_rds_lambda/?name="+mName+"&class="+mClass;
这是我从中得到的错误:
{message=No method found matching route test_rds_lambda/%3Fname%3DYoME%26class%3DYoClass for http method POST.}
我的请求 URL 路径有
?,=
等,但它们已更改为 HEX。即
%3Fname%3D
当它在 aws 控制台的“test api”中工作时,如何防止这种情况发生。
【问题讨论】:
标签: amazon-web-services aws-lambda aws-sdk aws-mobilehub