Skip to content

Commit

Permalink
added Access-Control-Allow-Origin header to BotController
Browse files Browse the repository at this point in the history
  • Loading branch information
Zomis committed Jun 20, 2015
1 parent 5a96563 commit d65e018
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions grails-app/controllers/net/zomis/duga/BotController.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ class BotController {

@Transactional(readOnly = true)
def post() {
println 'post'
Map parameters = request.getParameterMap();
println parameters
header 'Access-Control-Allow-Origin', '*'
if (parameters.size() != 3) {
render 'Expected three parameters: Room, apiKey, and text'
return
Expand All @@ -37,8 +40,8 @@ class BotController {
if (auth.authority == 'ROLE_ADMIN') {
println 'Request Text: ' + text
bot.postSingle(roomParams, text)
render 'OK'
return
def result = render 'OK'
return result
}
}
render 'Unauthorized'
Expand Down

0 comments on commit d65e018

Please sign in to comment.