Accessing the raw body of a PUT or POST request

前端 未结 3 1859
鱼传尺愫
鱼传尺愫 2020-11-28 23:43

I am implementing a RESTful API in Grails, and use a custom authentication scheme that involves signing the body of the request (in a manner similar to Amazon\'s S3 authenti

3条回答
  •  孤独总比滥情好
    2020-11-29 00:26

    As can be seen here

    http://jira.codehaus.org/browse/GRAILS-2017

    just turning off grails automatic handling of XML makes the text accessible in controllers. Like this

    class EventsController {   
    
    static allowedMethods = [add:'POST']
    
    def add = {
        log.info("Got request " + request.reader.text)      
        render "OK"
    }}
    

    Best, Anders

提交回复
热议问题