Skip to content

Commit

Permalink
tck: Run NoBodyResponseTest (#1169)
Browse files Browse the repository at this point in the history
* tck: NoBodyResponseTest
* groovy 4.0.22
* micronaut core 4.6.2
* servlet 4.10.1
  • Loading branch information
sdelamo authored Aug 22, 2024
1 parent dadc2ee commit b839ec3
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 11 deletions.
6 changes: 3 additions & 3 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[versions]
micronaut-docs = "2.0.0"
micronaut = "4.6.1"
groovy = "4.0.18"
micronaut = "4.6.2"
groovy = "4.0.22"
spock = "2.3-groovy-4.0"

managed-google-auth-library-oauth2http = "1.24.1"
Expand Down Expand Up @@ -32,7 +32,7 @@ micronaut-logging = "1.4.0"
micronaut-reactor = "3.5.0"
micronaut-rxjava3 = "3.5.0"
micronaut-serde = "2.11.0"
micronaut-servlet = "4.10.0"
micronaut-servlet = "4.10.1"
micronaut-tracing = "6.8.0"
micronaut-test = "4.5.0"
micronaut-discovery = "4.4.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,13 +130,25 @@ public MutableConvertibleValues<Object> getAttributes() {
@NonNull
public Optional<O> getBody() {
if (bodyType != null && bodyType.isAssignableFrom(byte[].class)) {
return (Optional<O>) Optional.of(googleHttpResponse.getBodyAsBytes());
byte[] bodyAsBytes = googleHttpResponse.getBodyAsBytes();
if (bodyAsBytes.length == 0) {
return Optional.empty();
}
return (Optional<O>) Optional.of(bodyAsBytes);
} else if (bodyType == null) {
return (Optional<O>) Optional.of(googleHttpResponse.getBodyAsText());
String str = googleHttpResponse.getBodyAsText();
if (StringUtils.isEmpty(str)) {
return Optional.empty();
}
return (Optional<O>) Optional.of(str);
} else {
return conversionService.convert(googleHttpResponse.getBodyAsText(), bodyType).or(() -> {
try {
return Optional.of(jsonMapper.readValue(googleHttpResponse.getBodyAsBytes(), bodyType));
byte[] bodyAsBytes = googleHttpResponse.getBodyAsBytes();
if (bodyAsBytes.length == 0) {
return Optional.empty();
}
return Optional.of(jsonMapper.readValue(bodyAsBytes, bodyType));
} catch (IOException e) {
throw new HttpClientResponseException("Error reading body", this);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
package io.micronaut.http.server.tck.gcp.function.tests;

import org.junit.platform.suite.api.ExcludeClassNamePatterns;
import org.junit.platform.suite.api.SelectPackages;
import org.junit.platform.suite.api.Suite;
import org.junit.platform.suite.api.SuiteDisplayName;
import org.junit.platform.suite.api.*;

@Suite
@SelectPackages({
Expand All @@ -12,7 +9,6 @@
})
@ExcludeClassNamePatterns({
"io.micronaut.http.server.tck.tests.FilterProxyTest",
"io.micronaut.http.server.tck.tests.NoBodyResponseTest"
})
@SuiteDisplayName("HTTP Server TCK for for GCP Function HTTP")
class GcpFunctionHttpServerTestSuite {
Expand Down

0 comments on commit b839ec3

Please sign in to comment.