我有控制器喜欢
public class UserController : ApiController
{
[Route("api/user")]
IHttpActionResult GetUser() { ... }
}
public class ResumeController : ApiController
{
[Route("api/user/resumes")]
IHttpActionResult GetResumes() { ... }
}
Run Code Online (Sandbox Code Playgroud)
有没有办法(除了通过推出自己ISwaggerProvider或将两个控制器合并为一个来覆盖默认实现)来强制执行组名?就像是
public class UserController : ApiController
{
[Route("api/user")]
[MagicalAttributeName(Group="User")]
IHttpActionResult GetUser() { ... }
}
public class ResumeController : ApiController
{
[Route("api/user/resumes")]
[MagicalAttributeName(Group="User")]
IHttpActionResult GetResumes() { ... }
}
Run Code Online (Sandbox Code Playgroud) 我创建了一个"hello world"lambda函数,然后使用AWS的API网关将其部署到终点:
所有非常基本的设置,但我肯定会将安全性更改为"打开",而我被告知可能需要15分钟才能解析域名,我发现即使在30岁之后,我也得到了以下响应:打开"终点:
{"message":"Missing Authentication Token"}
Run Code Online (Sandbox Code Playgroud)
我错过了一些明显的东西吗 这不应该与我所做的一样吗?
注意,有人指出这个图像是PUT而不是GET.我试过了两个,两个都回来了错误.只是为了检查我是否通过Postman运行GET和PUT 并获得类似但不完全相同的响应:
然后GET ......
当我在控制台中测试lambda函数时,它成功运行但在API网关中运行它,它给出了我对同一错误的不同表述:
Tue Sep 29 20:57:43 UTC 2015:由于配置错误导致执行失败:Lambda函数的权限无效
但我使用了控制台建议的默认权限.lambda函数本身非常基础,可以在这里找到:代码
根据http://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-payload-encodings.html
If contentHandling is not defined, and if the Content-Type header of the response and the Accept header of the original request match an entry of the binaryMediaTypes list, API Gateway passes through the body. This occurs when the Content-Type header and the Accept header are the same; otherwise, API Gateway converts the response body to the type specified in the Accept header.
我无法发出原始请求发送Accept标头.如何让我的AWS API Gateway以二进制格式返回?(图像/ JPEG).因为我从s3发回的图像在最后一个阶段被转换为文本(因为原始请求缺少Accept: image/jpeg标题).