ContentNegotiationSpec class with test Test accept: image/jpeg fails with groovyx.net.http.HttpResponseException.
Debugging the test, it turns out the HTTPBuilder call is getting a 404 response, despite sending the correct UUID request path. E.g. http://localhost:60838/image/1e3c64b2-5814-4681-8a8a-67297add98b0.
I think the problem is due to the ImageController#proxyUrl() trying to proxy the image binary via port 8080 instead of port 60838 (although that may not work anyway as it appears to be falling back to Apache/Nginx to serve the images from the FS). See:
EDIT: I tried setting grailsApplication.config.imageservice.apache.root = "http://localhost:${serverPort}/store" in the test setup() method but still got 404 result.
It appears there needs to be an additional proxy method for this test so that the raw file can be read from /tmp/image-service/store/b/2/2/f/650a0f33-0509-4e90-a1a9-ebc41b4ff22b/original and served back via the http requested http://localhost:58192/store/b/2/2/f/650a0f33-0509-4e90-a1a9-ebc41b4ff22b/original.
ContentNegotiationSpec
class with testTest accept: image/jpeg
fails withgroovyx.net.http.HttpResponseException
.Debugging the test, it turns out the HTTPBuilder call is getting a 404 response, despite sending the correct UUID request path. E.g.
http://localhost:60838/image/1e3c64b2-5814-4681-8a8a-67297add98b0
.I think the problem is due to the
ImageController#proxyUrl()
trying to proxy the image binary via port 8080 instead of port 60838 (although that may not work anyway as it appears to be falling back to Apache/Nginx to serve the images from the FS). See:EDIT: I tried setting
grailsApplication.config.imageservice.apache.root = "http://localhost:${serverPort}/store"
in the testsetup()
method but still got 404 result.It appears there needs to be an additional proxy method for this test so that the raw file can be read from
/tmp/image-service/store/b/2/2/f/650a0f33-0509-4e90-a1a9-ebc41b4ff22b/original
and served back via the http requestedhttp://localhost:58192/store/b/2/2/f/650a0f33-0509-4e90-a1a9-ebc41b4ff22b/original
.