Skip to content

Commit fdaf429

Browse files
Luis Alberto Medina BravoTheo
Luis Alberto Medina Bravo
authored and
Theo
committed
Support for Multi-Value Headers and Query String Parameters
1 parent 7ba36ba commit fdaf429

File tree

1 file changed

+65
-0
lines changed

1 file changed

+65
-0
lines changed

aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/APIGatewayProxyRequestEvent.java

+65
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.amazonaws.services.lambda.runtime.events;
22

33
import java.io.Serializable;
4+
import java.util.List;
45
import java.util.Map;
56

67
/**
@@ -18,8 +19,12 @@ public class APIGatewayProxyRequestEvent implements Serializable, Cloneable {
1819

1920
private Map<String, String> headers;
2021

22+
private Map<String, List<String>> multiValueHeaders;
23+
2124
private Map<String, String> queryStringParameters;
2225

26+
private Map<String, List<String>> multiValueQueryStringParameters;
27+
2328
private Map<String, String> pathParameters;
2429

2530
private Map<String, String> stageVariables;
@@ -914,6 +919,29 @@ public APIGatewayProxyRequestEvent withHeaders(Map<String, String> headers) {
914919
return this;
915920
}
916921

922+
/**
923+
* @return The multi value headers sent with the request
924+
*/
925+
public Map<String, List<String>> getMultiValueHeaders() {
926+
return multiValueHeaders;
927+
}
928+
929+
/**
930+
* @param multiValueHeaders The multi value headers sent with the request
931+
*/
932+
public void setMultiValueHeaders(Map<String, List<String>> multiValueHeaders) {
933+
this.multiValueHeaders = multiValueHeaders;
934+
}
935+
936+
/**
937+
* @param multiValueHeaders The multi value headers sent with the request
938+
* @return APIGatewayProxyRequestEvent object
939+
*/
940+
public APIGatewayProxyRequestEvent withMultiValueHeaders(Map<String, List<String>> multiValueHeaders) {
941+
this.setMultiValueHeaders(multiValueHeaders);
942+
return this;
943+
}
944+
917945
/**
918946
* @return The query string parameters that were part of the request
919947
*/
@@ -937,6 +965,29 @@ public APIGatewayProxyRequestEvent withQueryStringParamters(Map<String, String>
937965
return this;
938966
}
939967

968+
/**
969+
* @return The multi value query string parameters that were part of the request
970+
*/
971+
public Map<String, List<String>> getMultiValueQueryStringParameters() {
972+
return multiValueQueryStringParameters;
973+
}
974+
975+
/**
976+
* @param multiValueQueryStringParameters The multi value query string parameters that were part of the request
977+
*/
978+
public void setMultiValueQueryStringParameters(Map<String, List<String>> multiValueQueryStringParameters) {
979+
this.multiValueQueryStringParameters = multiValueQueryStringParameters;
980+
}
981+
982+
/**
983+
* @param multiValueQueryStringParameters The multi value query string parameters that were part of the request
984+
* @return APIGatewayProxyRequestEvent
985+
*/
986+
public APIGatewayProxyRequestEvent withMultiValueQueryStringParameters(Map<String, List<String>> multiValueQueryStringParameters) {
987+
this.setMultiValueQueryStringParameters(multiValueQueryStringParameters);
988+
return this;
989+
}
990+
940991
/**
941992
* @return The path parameters that were part of the request
942993
*/
@@ -1071,8 +1122,12 @@ public String toString() {
10711122
sb.append("httpMethod: ").append(getHttpMethod()).append(",");
10721123
if (getHeaders() != null)
10731124
sb.append("headers: ").append(getHeaders().toString()).append(",");
1125+
if (getMultiValueHeaders() != null)
1126+
sb.append("multiValueHeaders: ").append(getMultiValueHeaders().toString()).append(",");
10741127
if (getQueryStringParameters() != null)
10751128
sb.append("queryStringParameters: ").append(getQueryStringParameters().toString()).append(",");
1129+
if (getMultiValueQueryStringParameters() != null)
1130+
sb.append("multiValueQueryStringParameters: ").append(getMultiValueQueryStringParameters().toString()).append(",");
10761131
if (getPathParameters() != null)
10771132
sb.append("pathParameters: ").append(getPathParameters().toString()).append(",");
10781133
if (getStageVariables() != null)
@@ -1113,10 +1168,18 @@ public boolean equals(Object obj) {
11131168
return false;
11141169
if (other.getHeaders() != null && other.getHeaders().equals(this.getHeaders()) == false)
11151170
return false;
1171+
if (other.getMultiValueHeaders() == null ^ this.getMultiValueHeaders() == null)
1172+
return false;
1173+
if (other.getMultiValueHeaders() != null && other.getMultiValueHeaders().equals(this.getMultiValueHeaders()) == false)
1174+
return false;
11161175
if (other.getQueryStringParameters() == null ^ this.getQueryStringParameters() == null)
11171176
return false;
11181177
if (other.getQueryStringParameters() != null && other.getQueryStringParameters().equals(this.getQueryStringParameters()) == false)
11191178
return false;
1179+
if (other.getMultiValueQueryStringParameters() == null ^ this.getMultiValueQueryStringParameters() == null)
1180+
return false;
1181+
if (other.getMultiValueQueryStringParameters() != null && other.getMultiValueQueryStringParameters().equals(this.getMultiValueQueryStringParameters()) == false)
1182+
return false;
11201183
if (other.getPathParameters() == null ^ this.getPathParameters() == null)
11211184
return false;
11221185
if (other.getPathParameters() != null && other.getPathParameters().equals(this.getPathParameters()) == false)
@@ -1149,7 +1212,9 @@ public int hashCode() {
11491212
hashCode = prime * hashCode + ((getPath() == null) ? 0 : getPath().hashCode());
11501213
hashCode = prime * hashCode + ((getHttpMethod() == null) ? 0 : getHttpMethod().hashCode());
11511214
hashCode = prime * hashCode + ((getHeaders() == null) ? 0 : getHeaders().hashCode());
1215+
hashCode = prime * hashCode + ((getMultiValueHeaders() == null) ? 0 : getMultiValueHeaders().hashCode());
11521216
hashCode = prime * hashCode + ((getQueryStringParameters() == null) ? 0 : getQueryStringParameters().hashCode());
1217+
hashCode = prime * hashCode + ((getMultiValueQueryStringParameters() == null) ? 0 : getMultiValueQueryStringParameters().hashCode());
11531218
hashCode = prime * hashCode + ((getPathParameters() == null) ? 0 : getPathParameters().hashCode());
11541219
hashCode = prime * hashCode + ((getStageVariables() == null) ? 0 : getStageVariables().hashCode());
11551220
hashCode = prime * hashCode + ((getRequestContext() == null) ? 0 : getRequestContext().hashCode());

0 commit comments

Comments
 (0)