本文介绍了卷曲AWS api网关-{“消息”:“禁止”}卷曲:(3)< url>畸形的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试运行示例CURL来访问我设置的Amazon AWS api-gateway。
我用xxx替换了下面的任何私有值。

I'm trying to run a sample CURL to access Amazon AWS api-gateway that I setup.I substituted any private values below with xxx.

curl -X POST https://xxx.execute-api.eu-west-1.amazonaws.com/dev/screenshots?url=http://google.com/ -H "x-api-key: xxx" { "hash": "6ab016b2dad7ba49a992ba0213a91cf8",   "key": "6ab016b2dad7ba49a992ba0213a91cf8/original.png", "bucket": "mybucketname",   "url": "http://xxx.cloudfront.net/6ab016b2dad7ba49a992ba0213a91cf8/original.png"}

在以下示例中建模:

运行此命令时,我得到:

When I run this, I get:

{"message":"Forbidden"}curl: (3) <url> malformed
curl: (6) Couldn't resolve host 'hash'
curl: (6) Couldn't resolve host '6ab016b2dad7ba49a992ba0213a91cf8,key'
curl: (6) Couldn't resolve host '6ab016b2dad7ba49a992ba0213a91cf8'
curl: (6) Couldn't resolve host 'mybucketname,url'
curl: (3) [globbing] unmatched close brace/bracket in column 83

我也尝试对google.com周围的斜杠进行URL编码,但出现相同的错误。
是因为命令长度大于255,如果是,如何克服呢?我正在Windows 10中运行。

I also tried URL-encoding the slashes around google.com, but got same error.Is it because length of command is > 255, and if so, how to overcome that? I'm running in Windows 10.

推荐答案

@randomir指出其他字段正在返回,未传递给服务。另外,我必须在-H值前后加上花括号,以传递{ message: Forbidden}错误。

@randomir pointed out that the other fields were being returned, not passed to the service. Also, I had to put curly braces around the -H values to get passed the {"message":"Forbidden"} error.

curl -X POST  -H {"x-api-key: xxxxxxxx"} https://xxx.execute-api.eu-west-1.amazonaws.com/dev/screenshots?url=http://google.com/

这篇关于卷曲AWS api网关-{“消息”:“禁止”}卷曲:(3)&lt; url&gt;畸形的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-26 01:37