Docs: Support """ in console-response (#62876) (#62962)

We support `"""` in `console` snippets to emulate kibana's CONSOLE.
CONSOLE also spits out `"""` when a json field contains a new line or a
double quote. This adds support for those sorts of responses to the
handling of `console-response` snippets.
This commit is contained in:
Nik Everett 2020-09-28 11:51:07 -04:00 committed by GitHub
parent b814d10063
commit c3e07da437
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View File

@ -298,7 +298,9 @@ class RestTestsFromSnippetsTask extends SnippetsTask {
if (null == response.skip) {
current.println(" - match: ")
current.println(" \$body: ")
response.contents.eachLine { current.println(" $it") }
replaceBlockQuote(response.contents).eachLine {
current.println(" $it")
}
}
}

View File

@ -156,7 +156,7 @@ The API returns the following result:
{
"script" : {
"lang" : "mustache",
"source" : "{\"query\":{\"match\":{\"title\":\"{{query_string}}\"}}}",
"source" : """{"query":{"match":{"title":"{{query_string}}"}}}""",
"options": {
"content_type" : "application/json; charset=UTF-8"
}