Skip to content

Amazon.Lambda.AspNetCoreServer 3.x Query Encoding Regression #415

@alanedwardes

Description

@alanedwardes

Hi,

We are seeing a problem when upgrading to the 3.x version of Amazon.Lambda.AspNetCoreServer with regards to query strings needing URL encoding twice. Take the following controller:

[Route("health")]
public class HealthController : Controller
{
    public DateTimeOffset Index([FromQuery] DateTimeOffset testDateTimeOffset)
    {
        return testDateTimeOffset;
    }
}

Snippet from CloudFormation template for API gateway configuration:

"/{proxy+}": {
    "x-amazon-apigateway-any-method": {
        "x-amazon-apigateway-integration": {
            "httpMethod": "POST",
            "type": "aws_proxy",
            "uri": { "Fn::Sub": "arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${ApiLambda.Arn}/invocations" }
        }
    }
}

The request is sent to API Gateway, with an Asp.NET Lambda function behind it set as a proxy resource handling all requests.

Version /health?testDateTimeOffset={x} Response
3.x 2019-03-12T16%3A06%3A06.5498170%2B00%3A00 0001-01-01T00:00:00+00:00
2.1.x 2019-03-12T16%3A06%3A06.5498170%2B00%3A00 2019-03-12T16:06:06.549817+00:00

If we double encode the query parameter as 2019-03-12T16%253A06%253A06.5498170%252B00%253A00 with the 3.x package, the date time is as parsed correctly: 2019-03-12T16:06:06.549817+00:00.

This seems like incorrect behavior - single encoding should be enough as it was with 2.1.x.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis issue is a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions