io.aws.lambda.events.gateway.APIGatewayProxyResponse Maven / Gradle / Ivy
package io.aws.lambda.events.gateway;
import lombok.Data;
import lombok.experimental.Accessors;
import org.jetbrains.annotations.NotNull;
import java.io.Serializable;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Class that represents an APIGatewayProxyResponseEvent object
*/
@Data
@Accessors(chain = true)
public class APIGatewayProxyResponse implements Serializable {
private Object body;
private boolean isBase64Encoded = false;
private int statusCode = 200;
private Map headers;
private Map> multiValueHeaders;
public @NotNull Map getHeaders() {
return headers == null ? Collections.emptyMap() : headers;
}
public @NotNull Map> getMultiValueHeaders() {
return multiValueHeaders == null ? Collections.emptyMap() : multiValueHeaders;
}
public APIGatewayProxyResponse addHeader(@NotNull String name, @NotNull String value) {
if (this.headers == null)
this.headers = new HashMap<>();
headers.put(name, value);
return this;
}
public APIGatewayProxyResponse addMultiHeader(@NotNull String name, @NotNull List value) {
if (this.multiValueHeaders == null)
this.multiValueHeaders = new HashMap<>();
multiValueHeaders.put(name, value);
return this;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy