File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
grails-test-suite-web/src/test/groovy/grails/rest/web Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ import org.grails.plugins.web.mime.MimeTypesFactoryBean
2525import grails.web.mime.MimeType
2626import grails.core.support.proxy.ProxyHandler
2727import org.grails.web.util.GrailsApplicationAttributes
28+ import org.springframework.http.HttpHeaders
2829import org.springframework.web.servlet.ModelAndView
2930import spock.lang.Issue
3031import spock.lang.Specification
@@ -251,6 +252,15 @@ class RespondMethodSpec extends Specification{
251252 response. json. name == ' Jeff'
252253 response. status == 201
253254 }
255+
256+ @Issue ([' grails/grails-core#10312' ])
257+ void ' Test respond with a file argument' () {
258+ when :
259+ controller. respondWithFile()
260+
261+ then : " the fileName has quotes around it"
262+ response. getHeader(HttpHeaders . CONTENT_DISPOSITION ) == ' attachment;filename="good morning.txt"'
263+ }
254264}
255265
256266@Artefact (" Controller" )
@@ -278,6 +288,10 @@ class BookController {
278288 def respondWithMapAndNamedArguments () {
279289 respond([name : ' Jeff' ], status : 201 )
280290 }
291+
292+ def respondWithFile () {
293+ respond([file : " abc" . bytes, fileName : " good morning.txt" ])
294+ }
281295}
282296@Entity
283297class Book {
You can’t perform that action at this time.
0 commit comments