Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

check.response.body value must not be quoted #7936

Closed
wants to merge 1 commit into from
Closed

check.response.body value must not be quoted #7936

wants to merge 1 commit into from

Conversation

mheck136
Copy link

When checking the response body of an http request, the expected string must not be quoted. Otherwise the quotes are expected to be part of the response body.

When checking the response body of an http request, the expected string must not be quoted. Otherwise the quotes are expected to be part of the response body.
@elasticmachine
Copy link
Collaborator

Since this is a community submitted pull request, a Jenkins build has not been kicked off automatically. Can an Elastic organization member please verify the contents of this patch and then kick off a build manually?

@@ -479,7 +479,7 @@ contains JSON:
'X-API-Key': '12345-mykey-67890'
check.response:
status: 200
body: '{"status": "ok"}'
body: {"status": "ok"}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The input is yaml. By using single quotes, the body will be parsed as a string. Single quotes will be removed, double quotes will be kept. By removing the single quotes, body is parsed as an object (with double quotes being removed). Checking the configuration object in heartbeat (has been changed recently), body must be a list of regular expressions:

body: ['{"status":\s*"ok"}']

Using \s+ we make whitepsace optional.

@urso urso requested a review from andrewvc August 10, 2018 12:42
@ruflin
Copy link
Member

ruflin commented Aug 13, 2018

Should this PR be opened against master and then backported (if needed)? Will also need a changelog.

@andrewvc
Copy link
Contributor

andrewvc commented Nov 9, 2018

#8667 will make this change unnecessary since we'll have a better mechanism for checking JSON.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants