Skip to content

Instantly share code, notes, and snippets.

@gregopet
Created December 4, 2013 09:59
Show Gist options
  • Save gregopet/7785091 to your computer and use it in GitHub Desktop.
Save gregopet/7785091 to your computer and use it in GitHub Desktop.
Trying to figure out a Grails behaviour
//This happens with the default 2.3.3 Config.groovy:
//curl 'http://localhost:8080/test-accept-header/test/index' -H 'Accept: application/json, */*'
//FIRST BLOCK
//curl 'http://localhost:8080/test-accept-header/test/index' -H 'Accept: application/json'
//WILDCARD BLOCK
class TestController {
def index() {
withFormat {
xml {
render text:'FIRST BLOCK'
}
'*' {
render text: 'WILDCARD BLOCK'
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment