From ca19ed2dddc1cf5261b83e0ef066e27df4ef558f Mon Sep 17 00:00:00 2001 From: Luis Alberto Medina Bravo Date: Mon, 29 Oct 2018 11:54:55 -0400 Subject: [PATCH] Support for Multi-Value Headers and Query String Parameters --- .../events/APIGatewayProxyRequestEvent.java | 65 +++++++++++++++++++ 1 file changed, 65 insertions(+) diff --git a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/APIGatewayProxyRequestEvent.java b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/APIGatewayProxyRequestEvent.java index b827eb47..8e790ec3 100644 --- a/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/APIGatewayProxyRequestEvent.java +++ b/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/APIGatewayProxyRequestEvent.java @@ -1,6 +1,7 @@ package com.amazonaws.services.lambda.runtime.events; import java.io.Serializable; +import java.util.List; import java.util.Map; /** @@ -18,8 +19,12 @@ public class APIGatewayProxyRequestEvent implements Serializable, Cloneable { private Map headers; + private Map> multiValueHeaders; + private Map queryStringParameters; + private Map> multiValueQueryStringParameters; + private Map pathParameters; private Map stageVariables; @@ -914,6 +919,29 @@ public APIGatewayProxyRequestEvent withHeaders(Map headers) { return this; } + /** + * @return The multi value headers sent with the request + */ + public Map> getMultiValueHeaders() { + return multiValueHeaders; + } + + /** + * @param multiValueHeaders The multi value headers sent with the request + */ + public void setMultiValueHeaders(Map> multiValueHeaders) { + this.multiValueHeaders = multiValueHeaders; + } + + /** + * @param multiValueHeaders The multi value headers sent with the request + * @return APIGatewayProxyRequestEvent object + */ + public APIGatewayProxyRequestEvent withMultiValueHeaders(Map> multiValueHeaders) { + this.setMultiValueHeaders(multiValueHeaders); + return this; + } + /** * @return The query string parameters that were part of the request */ @@ -937,6 +965,29 @@ public APIGatewayProxyRequestEvent withQueryStringParamters(Map return this; } + /** + * @return The multi value query string parameters that were part of the request + */ + public Map> getMultiValueQueryStringParameters() { + return multiValueQueryStringParameters; + } + + /** + * @param multiValueQueryStringParameters The multi value query string parameters that were part of the request + */ + public void setMultiValueQueryStringParameters(Map> multiValueQueryStringParameters) { + this.multiValueQueryStringParameters = multiValueQueryStringParameters; + } + + /** + * @param multiValueQueryStringParameters The multi value query string parameters that were part of the request + * @return APIGatewayProxyRequestEvent + */ + public APIGatewayProxyRequestEvent withMultiValueQueryStringParameters(Map> multiValueQueryStringParameters) { + this.setMultiValueQueryStringParameters(multiValueQueryStringParameters); + return this; + } + /** * @return The path parameters that were part of the request */ @@ -1071,8 +1122,12 @@ public String toString() { sb.append("httpMethod: ").append(getHttpMethod()).append(","); if (getHeaders() != null) sb.append("headers: ").append(getHeaders().toString()).append(","); + if (getMultiValueHeaders() != null) + sb.append("multiValueHeaders: ").append(getMultiValueHeaders().toString()).append(","); if (getQueryStringParameters() != null) sb.append("queryStringParameters: ").append(getQueryStringParameters().toString()).append(","); + if (getMultiValueQueryStringParameters() != null) + sb.append("multiValueQueryStringParameters: ").append(getMultiValueQueryStringParameters().toString()).append(","); if (getPathParameters() != null) sb.append("pathParameters: ").append(getPathParameters().toString()).append(","); if (getStageVariables() != null) @@ -1113,10 +1168,18 @@ public boolean equals(Object obj) { return false; if (other.getHeaders() != null && other.getHeaders().equals(this.getHeaders()) == false) return false; + if (other.getMultiValueHeaders() == null ^ this.getMultiValueHeaders() == null) + return false; + if (other.getMultiValueHeaders() != null && other.getMultiValueHeaders().equals(this.getMultiValueHeaders()) == false) + return false; if (other.getQueryStringParameters() == null ^ this.getQueryStringParameters() == null) return false; if (other.getQueryStringParameters() != null && other.getQueryStringParameters().equals(this.getQueryStringParameters()) == false) return false; + if (other.getMultiValueQueryStringParameters() == null ^ this.getMultiValueQueryStringParameters() == null) + return false; + if (other.getMultiValueQueryStringParameters() != null && other.getMultiValueQueryStringParameters().equals(this.getMultiValueQueryStringParameters()) == false) + return false; if (other.getPathParameters() == null ^ this.getPathParameters() == null) return false; if (other.getPathParameters() != null && other.getPathParameters().equals(this.getPathParameters()) == false) @@ -1149,7 +1212,9 @@ public int hashCode() { hashCode = prime * hashCode + ((getPath() == null) ? 0 : getPath().hashCode()); hashCode = prime * hashCode + ((getHttpMethod() == null) ? 0 : getHttpMethod().hashCode()); hashCode = prime * hashCode + ((getHeaders() == null) ? 0 : getHeaders().hashCode()); + hashCode = prime * hashCode + ((getMultiValueHeaders() == null) ? 0 : getMultiValueHeaders().hashCode()); hashCode = prime * hashCode + ((getQueryStringParameters() == null) ? 0 : getQueryStringParameters().hashCode()); + hashCode = prime * hashCode + ((getMultiValueQueryStringParameters() == null) ? 0 : getMultiValueQueryStringParameters().hashCode()); hashCode = prime * hashCode + ((getPathParameters() == null) ? 0 : getPathParameters().hashCode()); hashCode = prime * hashCode + ((getStageVariables() == null) ? 0 : getStageVariables().hashCode()); hashCode = prime * hashCode + ((getRequestContext() == null) ? 0 : getRequestContext().hashCode());