From e13b331a1e0b09145a0bd9c15c304f9d7d67442b Mon Sep 17 00:00:00 2001 From: Dominik Adam Przybysz Date: Sun, 1 Feb 2015 22:03:56 +0100 Subject: [PATCH] Add description of request object in closures Change-Id: I045d91431b37ded10b37cfc017d0be1dfddfe0da --- README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/README.md b/README.md index cb873b3..daa1f09 100644 --- a/README.md +++ b/README.md @@ -56,6 +56,17 @@ or via sending POST request to localhost:/serverControl * method - POST|PUT|DELETE|GET|TRACE|OPTION|HEAD, expected http method of request, default POST * responseHeaders - groovyClosure as string which must evaluate to Map which will be added to response headers, default { _ -> [:] } +In closures input parameter (called req) contains properties: + + +* text - request body as java.util.String +* headers - java.util.Map with request headers +* query - java.util.Map with query parameters +* xml - groovy.util.slurpersupport.GPathResult created from request body (if request body is valid xml) +* soap - groovy.util.slurpersupport.GPathResult created from request body without Envelope and Body elements (if request body is valid soap xml) +* json - java.lang.Object created from request body (if request body is valid json) +* path - java.util.List with not empty parts of request path + Response if success: ```