bifravst / http-api-mock

Helper functions for AWS lambdas written in TypeScript.
https://github.com/bifravst/http-api-mock
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Wrongly matches response with query string #44

Closed coderbyheart closed 5 months ago

coderbyheart commented 5 months ago

This should not happen:

2024-06-04T23:19:17.471Z    b28016ad-0a8f-491e-8ae7-38afe9f64484    INFO    
{
    "event": {
        "resource": "/{proxy+}",
        "path": "/v1/location/history",
        "httpMethod": "GET",
        "headers": {
            "Accept": "application/json; charset=utf-8",
            "Accept-Encoding": "br, gzip, deflate",
            "Accept-Language": "*",
            "Authorization": "Bearer apiKey_Nordic",
            "CloudFront-Forwarded-Proto": "https",
            "CloudFront-Is-Desktop-Viewer": "true",
            "CloudFront-Is-Mobile-Viewer": "false",
            "CloudFront-Is-SmartTV-Viewer": "false",
            "CloudFront-Is-Tablet-Viewer": "false",
            "CloudFront-Viewer-ASN": "16509",
            "CloudFront-Viewer-Country": "IE",
            "Host": "p4bt1b2apj.execute-api.eu-west-1.amazonaws.com",
            "sec-fetch-mode": "cors",
            "User-Agent": "node",
            "Via": "1.1 e1b65e244f968883648857c99088d77e.cloudfront.net (CloudFront)",
            "X-Amz-Cf-Id": "wqxeSjLzG-oRM-2Opcp5pK_jmqcPpsUiZBPmVZTVOiT8f2pLR4qMjg==",
            "X-Amzn-Trace-Id": "Root=1-665fa0f5-099cf423570ea07b148d6837",
            "X-Forwarded-For": "34.247.85.244, 130.176.209.119",
            "X-Forwarded-Port": "443",
            "X-Forwarded-Proto": "https"
        },
        "multiValueHeaders": {
            "Accept": [
                "application/json; charset=utf-8"
            ],
            "Accept-Encoding": [
                "br, gzip, deflate"
            ],
            "Accept-Language": [
                "*"
            ],
            "Authorization": [
                "Bearer apiKey_Nordic"
            ],
            "CloudFront-Forwarded-Proto": [
                "https"
            ],
            "CloudFront-Is-Desktop-Viewer": [
                "true"
            ],
            "CloudFront-Is-Mobile-Viewer": [
                "false"
            ],
            "CloudFront-Is-SmartTV-Viewer": [
                "false"
            ],
            "CloudFront-Is-Tablet-Viewer": [
                "false"
            ],
            "CloudFront-Viewer-ASN": [
                "16509"
            ],
            "CloudFront-Viewer-Country": [
                "IE"
            ],
            "Host": [
                "p4bt1b2apj.execute-api.eu-west-1.amazonaws.com"
            ],
            "sec-fetch-mode": [
                "cors"
            ],
            "User-Agent": [
                "node"
            ],
            "Via": [
                "1.1 e1b65e244f968883648857c99088d77e.cloudfront.net (CloudFront)"
            ],
            "X-Amz-Cf-Id": [
                "wqxeSjLzG-oRM-2Opcp5pK_jmqcPpsUiZBPmVZTVOiT8f2pLR4qMjg=="
            ],
            "X-Amzn-Trace-Id": [
                "Root=1-665fa0f5-099cf423570ea07b148d6837"
            ],
            "X-Forwarded-For": [
                "34.247.85.244, 130.176.209.119"
            ],
            "X-Forwarded-Port": [
                "443"
            ],
            "X-Forwarded-Proto": [
                "https"
            ]
        },
        "queryStringParameters": {
            "deviceId": "oob-350006663122670",
            "end": "2024-06-04T23:19:17.407Z",
            "pageLimit": "100",
            "start": "2024-06-03T23:19:17.414Z"
        },
        "multiValueQueryStringParameters": {
            "deviceId": [
                "oob-350006663122670"
            ],
            "end": [
                "2024-06-04T23:19:17.407Z"
            ],
            "pageLimit": [
                "100"
            ],
            "start": [
                "2024-06-03T23:19:17.414Z"
            ]
        },
        "pathParameters": {
            "proxy": "v1/location/history"
        },
        "stageVariables": null,
        "requestContext": {
            "resourceId": "7figm0",
            "resourcePath": "/{proxy+}",
            "httpMethod": "GET",
            "extendedRequestId": "Y3YWZGURDoEEM6A=",
            "requestTime": "04/Jun/2024:23:19:17 +0000",
            "path": "/prod/v1/location/history",
            "accountId": "752072828702",
            "protocol": "HTTP/1.1",
            "stage": "prod",
            "domainPrefix": "p4bt1b2apj",
            "requestTimeEpoch": 1717543157461,
            "requestId": "4f81103f-a759-41d3-90a5-941faefdda0d",
            "identity": {
                "cognitoIdentityPoolId": null,
                "accountId": null,
                "cognitoIdentityId": null,
                "caller": null,
                "sourceIp": "34.247.85.244",
                "principalOrgId": null,
                "accessKey": null,
                "cognitoAuthenticationType": null,
                "cognitoAuthenticationProvider": null,
                "userArn": null,
                "userAgent": "node",
                "user": null
            },
            "domainName": "p4bt1b2apj.execute-api.eu-west-1.amazonaws.com",
            "deploymentId": "aw1xjx",
            "apiId": "p4bt1b2apj"
        },
        "body": null,
        "isBase64Encoded": false
    }
}

2024-06-04T23:19:17.501Z    b28016ad-0a8f-491e-8ae7-38afe9f64484    DEBUG   Checking if response exists for GET v1/location/history?deviceId=oob-350006663122670&end=2024-06-04T23%3A19%3A17.407Z&pageLimit=100&start=2024-06-03T23%3A19%3A17.414Z...
2024-06-04T23:19:17.561Z    b28016ad-0a8f-491e-8ae7-38afe9f64484    DEBUG   Found response items: 1
2024-06-04T23:19:17.621Z    b28016ad-0a8f-491e-8ae7-38afe9f64484    DEBUG   Return response 
{
    "response": {
        "statusCode": 200,
        "headers": {
            "Content-Type": "application/json"
        },
        "body": "{\n\"items\": [\n{\n\"deviceId\": \"oob-350006668770474\",\n\"id\": \"61b0d775-8384-4867-a25a-0a77f71f07ca\",\n\"insertedAt\": \"2024-06-04T23:18:15.010Z\",\n\"lat\": \"63.42061758\",\n\"lon\": \"10.43720484\",\n\"meta\": {},\n\"serviceType\": \"SCELL\",\n\"uncertainty\": \"366\"\n}\n],\n\"total\": 1\n}\n",
        "isBase64Encoded": false
    }
}
coderbyheart commented 5 months ago

Closed via c61bfb3f07e132ddb4337ca5ab973aa95638cd96