- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我最近将 APIM 实例从开发人员层更改为消费层,并且在验证内容策略中看到了一些奇怪的行为。在开发人员层,此策略将按预期工作并返回 400 错误以及相应的错误消息。
以下是政策:
<validate-content unspecified-content-type-action="prevent" max-size="102400" size-exceeded-action="prevent">
<content type="application/json" validate-as="json" action="prevent" />
</validate-content>
下面是来自开发人员层的跟踪和响应的示例(预期行为):
//Trace
validate-content (0.100 ms)
{
"name": "application/json",
"type": "RequestBody",
"validationRule": "IncorrectMessage",
"details": "Body of the request does not conform to the definition skills-POST-request, which is associated with the content type application/json. Property 'nam' has not been defined and the schema does not allow additional properties. Line: 1, Position: 7",
"action": "Prevented"
}
//Response
HTTP/1.1 400 Bad Request
vary: Origin
{
"statusCode": 400,
"message": "Body of the request does not conform to the definition skills-POST-request, which is associated with the content type application/json. Property 'nam' has not been defined and the schema does not allow additional properties. Line: 1, Position: 7"
}
但是,现在消费层上的相同策略返回以下跟踪和响应(不正确的行为):
//Trace
validate-content (4.736 ms)
{
"name": "application/json",
"type": "RequestBody",
"validationRule": "IncorrectMessage",
"details": "Body of the request does not conform to the definition skills-POST-request, which is associated with the content type application/json. Property 'nam' has not been defined and the schema does not allow additional properties. Line: 1, Position: 7",
"action": "Prevented"
}
validate-content (0.714 ms)
{
"name": null,
"type": "RequestBody",
"validationRule": "ValidationException",
"details": "Body of the request cannot be validated for the content type application/json. Value cannot be null.\r\nParameter name: key",
"action": "Prevented"
}
validate-content (2.679 ms)
{
"messages": [
"Value cannot be null.\r\nParameter name: key"
]
}
//response
HTTP/1.1 500 Internal Server Error
vary: Origin
{
"statusCode": 500,
"message": "Internal server error",
"activityId": "b3d76aed-fdf0-4240-a5c1-db49fed82105"
}
这看起来可能是消费层的内容验证策略中的某种错误?
最佳答案
我向 Microsoft 提出了支持请求,他们确定这是 API 管理中的错误。解决方法是将以下内容添加到策略中:
errors-variable-name="requestBodyValidation"
所以最终的政策现在看起来像:
<validate-content unspecified-content-type-action="prevent" max-size="102400" size-exceeded-action="prevent" errors-variable-name="requestBodyValidation">
<content type="application/json" validate-as="json" action="prevent" />
</validate-content>
关于azure - APIM - 验证消费层的内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70268178/
在我的 azure devops 管道中,我有一个任务 AzureCLI@2,它将 api 部署到 apim。我如何使用 az apim api 来执行相同的任务更新api?我知道有一个操作可以做到这
我理解当请求包含 Ocp-Apim-Trace: true 时,如下所示: GET /api/v1/BotConfig HTTP/1.1 Host: xyz.azure-api.net Cache-C
我理解当请求包含 Ocp-Apim-Trace: true 时,如下所示: GET /api/v1/BotConfig HTTP/1.1 Host: xyz.azure-api.net Cache-C
我已经创建了 web api 并尝试使用 c# 发出 GET 请求,如下所示 namespace APIMCheck { class Program { static void Main(
我想在 Azure API 管理策略中实现客户端证书验证,以检查客户端是否具有有效证书(按照以下文档)。 https://learn.microsoft.com/en-us/azure/api-man
我有一个带有自定义域和多个 API 的 azure APIM,如下面的屏幕截图所示:- 每个 API 下都有多个端点,并且所有端点都具有相同的主机名。自定义域级别有一个协商客户端证书 设置,我只想为其
我最近将 APIM 实例从开发人员层更改为消费层,并且在验证内容策略中看到了一些奇怪的行为。在开发人员层,此策略将按预期工作并返回 400 错误以及相应的错误消息。 以下是政策: 下面是来
我目前仍在 APIM 中探索。我在有效负载 #1 中有一个有效负载,我想将其转换为另一个有效负载 #2(预期)。 我将如何编辑我的策略来构建此有效负载? 有效负载1 { "dependtee_
我正在尝试通过 APIM 将文件批量上传到 Azure 存储帐户。在本地,我可以使用 REST API 将文件上传到 azure 存储帐户。但是,通过 APIM 我无法上传文件。我收到 401 错误。
在我的口腔中,我有查询参数调用“PageSize”,我需要检查用户输入情况比较严重,需要向用户显示消息 比我在出站部分中放置的 = 20">
来自Azure API management pricing page我发现除了开发人员层和高级层之外,不支持虚拟网络。 目前,在配置 APIM 的 VN 时,我的开发人员级别订阅可以在“关闭”、“外
我在 Azure API 管理中有以下策略。这样就可以正常工作了: @{ try { // ... doing something
我正在尝试通过 Azure APIM 访问本地 API。如果我使用 VNET 和 VPN 隧道,我可以访问 On-Prem API,但是,这不是一个理想的解决方案。我正在尝试让混合连接(端口桥)以相同
有没有办法将通过 APIM 请求传入的查询参数作为路径参数传递给后端服务调用?例如: 对于以下 API 调用 base_url/a/{pathParam1}?query=Qvalue 我想将 URL
目前我已经创建了一个 Azure APIM 实例,URL 如下所示。 https://abc-test.azure-api.net 我想使用此 APIM 实例来支持开发和 QA 环境。所以我想设置如下
我正在尝试处理后端 API(REST),没有可通过 Azure APIM 访问的 swagger 文档。我希望所有调用都定向到后端 API,而不是为所有资源手动创建 GET/PUT/POST。我的所有
来自Azure API management pricing page我发现除了开发人员层和高级层之外,不支持虚拟网络。 目前,在配置 APIM 的 VN 时,我的开发人员级别订阅可以在“关闭”、“外
我在 Azure API 管理中有以下策略。这样就可以正常工作了: @{ try { // ... doing something
我正在尝试通过 Azure APIM 访问本地 API。如果我使用 VNET 和 VPN 隧道,我可以访问 On-Prem API,但是,这不是一个理想的解决方案。我正在尝试让混合连接(端口桥)以相同
有没有办法将通过 APIM 请求传入的查询参数作为路径参数传递给后端服务调用?例如: 对于以下 API 调用 base_url/a/{pathParam1}?query=Qvalue 我想将 URL
我是一名优秀的程序员,十分优秀!