小编sop*_*_pt的帖子

使用aws cli“ --cli-input-json”创建dynamodb表

我一直在尝试使用以下json(testbootstraptable.json)文件创建dynamo数据库表:

{
        "AttributeDefinitions": [
            {
                "AttributeName": "test1",
                "AttributeType": "S"
            },
            {
                "AttributeName": "test2",
                "AttributeType": "S"
            }
        ],
        "TableName": "BOOTSTRAP_TEST_TBL",
        "KeySchema": [
            {
                "AttributeName": "test1",
                "KeyType": "HASH"
            },
            {
                "AttributeName": "test2",
                "KeyType": "RANGE"
            }
        ],
        "ProvisionedThroughput": {
            "NumberOfDecreasesToday": 0,
            "ReadCapacityUnits": 35,
            "WriteCapacityUnits": 35
        }
}
Run Code Online (Sandbox Code Playgroud)

我已经尝试过多次基于Google搜索的不同变体形式,但始终出现以下错误:

Error parsing parameter 'cli-input-json': Invalid JSON: Expecting value: line 1 column 1 (char 0)
JSON received: testbootstraptable.json
Run Code Online (Sandbox Code Playgroud)

AWS命令:

$ aws dynamodb create-table --cli-input-json testbootstraptable.json --region us-west-2
Run Code Online (Sandbox Code Playgroud)

amazon-web-services amazon-dynamodb aws-cli

2
推荐指数
1
解决办法
1815
查看次数

通过 Wiremock 存根获取请求会引发错误

我正在尝试设置一个 wiremock 服务器来对一个进行 get http 调用的类进行单元测试。我能够成功设置模拟服务器,但是当我尝试存根请求时遇到错误。我对 WireMock 非常陌生,这似乎是一件非常简单的事情。请指教:

@Test
public void testMethod{
.........
    WireMockServer wireMockServer = new WireMockServer(8089);
    wireMockServer.start();

    stubFor(get(urlEqualTo("/api/get-magic"))
        .willReturn(aResponse()
            .withHeader("Content-Type", "application/json")
            .withBody("{\"currently\":{\"windSpeed\":12.34}}")));
........
    wireMockServer.start();

}
Run Code Online (Sandbox Code Playgroud)

堆栈跟踪:

com.fasterxml.jackson.core.JsonParseException: Unexpected character ('<' (code 60)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')
 at [Source: <html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>Error 403 No valid crumb was included in the request</title>
</head>
<body><h2>HTTP ERROR 403</h2>
<p>Problem accessing /__admin/mappings. Reason:
<pre>    No valid crumb was included in the …
Run Code Online (Sandbox Code Playgroud)

testing unit-testing http mocking wiremock

1
推荐指数
1
解决办法
3800
查看次数

void typedef如何在C中工作

我正在使用一个故意混淆的代码,其中包含一个我无法理解的奇怪的typedef.任何人都可以解释以下typedef意味着什么:

typedef void (*p_t)(char* a1, char* a2, int a3);
Run Code Online (Sandbox Code Playgroud)

后来主要使用如下:

int main(void) {
    p_t p = &some_function;
    p("foo", "bar", 42);
}
Run Code Online (Sandbox Code Playgroud)

c typedef

0
推荐指数
1
解决办法
108
查看次数