Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tck: Run NoBodyResponseTest #1169

Merged
merged 4 commits into from
Aug 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading