Skip to content

Commit

Permalink
GH-953 Modify test to show returning non-default status code
Browse files Browse the repository at this point in the history
Resolves #953
  • Loading branch information
olegz committed Oct 23, 2023
1 parent 71ee83e commit 253f625
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1225,6 +1225,7 @@ public void testResponseBase64Encoded() throws Exception {
String result = new String(output.toByteArray(), StandardCharsets.UTF_8);
Map resultMap = mapper.fromJson(result, Map.class);
assertThat((boolean) resultMap.get(AWSLambdaUtils.IS_BASE64_ENCODED)).isTrue();
assertThat((int) resultMap.get(AWSLambdaUtils.STATUS_CODE)).isEqualTo(201);
String body = new String(Base64.getDecoder().decode((String) resultMap.get(AWSLambdaUtils.BODY)), StandardCharsets.UTF_8);
assertThat(body).isEqualTo("hello");
}
Expand Down Expand Up @@ -1694,7 +1695,10 @@ public Supplier<String> supply() {
public Function<Message<String>, Message<String>> echoStringMessage() {
return m -> {
String encodedPayload = Base64.getEncoder().encodeToString(m.getPayload().getBytes(StandardCharsets.UTF_8));
return MessageBuilder.withPayload(encodedPayload).setHeader("isBase64Encoded", true).build();
return MessageBuilder.withPayload(encodedPayload)
.setHeader("isBase64Encoded", true)
.setHeader("statusCode", 201)
.build();
};
}

Expand Down

0 comments on commit 253f625

Please sign in to comment.