Skip to content

Commit 3138535

Browse files
authored
Merge pull request #283 from AtlasOfLivingAustralia/feature/issue281
Feature/issue281
2 parents c8aac0e + 26995ef commit 3138535

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

grails-app/services/au/org/ala/ecodata/forms/EcpWebService.groovy

+5-2
Original file line numberDiff line numberDiff line change
@@ -618,7 +618,7 @@ class EcpWebService {
618618

619619
ResponseBody responseBody = response.body()
620620
okhttp3.MediaType respContentType = responseBody.contentType()
621-
String mediaType = respContentType.type()?.toLowerCase()
621+
String mediaType = respContentType.toString()?.toLowerCase()
622622
def responseData
623623
if (isTextBased(mediaType)) {
624624
responseData = responseBody.string()
@@ -627,7 +627,10 @@ class EcpWebService {
627627
responseData = objectMapper.readValue(responseData, Object)
628628
}
629629
} else {
630-
responseData = responseBody.byteStream()
630+
// This is only used for the /document/createThumbnail endpoint. Because the thumbnail is small we
631+
// can get away with reading the entire response into memory. If dealing with large files
632+
// we might have to remove the try with resources and handle the stream manually.
633+
responseData = responseBody.bytes()
631634
}
632635

633636
result.statusCode = result.status = response.code()

0 commit comments

Comments
 (0)