File tree Expand file tree Collapse file tree 1 file changed +29
-29
lines changed Expand file tree Collapse file tree 1 file changed +29
-29
lines changed Original file line number Diff line number Diff line change @@ -285,35 +285,35 @@ response:
285285
286286Now, `example.groovy` can control the responses, such as :
287287
288- 1. ** the content of a file to return**
289-
290- ` ` ` groovy
291- respond().withFile('some-file.xml')
292- ` ` `
293-
294- 2. ** a literal string to return**
295-
296- ` ` ` groovy
297- respond().withContent('''<?xml version="1.0" encoding="UTF-8"?>
298- <env:Envelope xmlns:env="http://www.w3.org/2001/12/soap-envelope">
299- <env:Header/>
300- <env:Body>
301- <getPetByIdResponse xmlns="urn:com:example:petstore">
302- <id>3</id>
303- <name>Custom pet name</name>
304- </getPetByIdResponse>
305- </env:Body>
306- </env:Envelope>
307- ''')
308- ` ` `
309-
310- 3. ** a specific HTTP status code**
311-
312- Setting the status code to 500 will trigger a fault message to be returned if one is defined within the WSDL document.
313-
314- ` ` ` groovy
315- respond().withStatusCode(500)
316- ` ` `
288+ # ### Return the content of a file
289+
290+ ` ` ` groovy
291+ respond().withFile('some-file.xml')
292+ ` ` `
293+
294+ # ### Return a literal string
295+
296+ ` ` ` groovy
297+ respond().withContent('''<?xml version="1.0" encoding="UTF-8"?>
298+ <env:Envelope xmlns:env="http://www.w3.org/2001/12/soap-envelope">
299+ <env:Header/>
300+ <env:Body>
301+ <getPetByIdResponse xmlns="urn:com:example:petstore">
302+ <id>3</id>
303+ <name>Custom pet name</name>
304+ </getPetByIdResponse>
305+ </env:Body>
306+ </env:Envelope>
307+ ''')
308+ ` ` `
309+
310+ # ### Return a specific HTTP status code
311+
312+ Setting the status code to 500 will trigger a fault message to be returned if one is defined within the WSDL document.
313+
314+ ` ` ` groovy
315+ respond().withStatusCode(500)
316+ ` ` `
317317
318318# ### Scripting examples
319319
You can’t perform that action at this time.
0 commit comments