Bug 65108 - Passing a numeric variable to GraphQL HTTP Request logs an error and doesn't send any variables.
Summary: Passing a numeric variable to GraphQL HTTP Request logs an error and doesn't ...
Status: NEW
Alias: None
Product: JMeter
Classification: Unclassified
Component: HTTP (show other bugs)
Version: 5.4
Hardware: PC All
: P2 normal (vote)
Target Milestone: JMETER 5.4.1
Assignee: JMeter issues mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-01-26 17:16 UTC by andy
Modified: 2021-03-12 21:24 UTC (History)
0 users



Attachments
Simple example for testing (5.94 KB, application/xml)
2021-01-26 17:16 UTC, andy
Details

Note You need to log in before you can comment on or make changes to this bug.
Description andy 2021-01-26 17:16:43 UTC
Created attachment 37720 [details]
Simple example for testing

Using the GraphQL HTTP Request sampler with Variables set like this:

{
	"number": ${number}
}

(Note no " around the value)

Results in the following error:

2021-01-26 17:07:23,695 ERROR o.a.j.p.h.u.GraphQLRequestParamUtils: Ignoring the GraphQL query variables content due to the syntax error: Unrecognized token '$': was expecting (JSON String, Number, Array, Object or token 'null', 'true' or 'false')
 at [Source: (String)"{
	"number": ${number}
}
"; line: 2, column: 13]

And the POST Data is missing the variables:

POST data:
{"operationName":"Test","query":"query Test() {\n\t\n}"}

Adding quotes gives the expected behaviour:

POST data:
{"operationName":"Test","variables":{"number":"0"},"query":"query Test() {\n\t\n}"}

But the value is now passed as a string instead of a number, so is not the correct request.
Comment 1 Felix Schumacher 2021-01-26 17:27:20 UTC
Seems like the graphql sampler is parsing the JSON structure too early, i.e. when the variables are not set, yet.
Comment 2 Felix Schumacher 2021-03-12 21:24:41 UTC
https://github.com/apache/jmeter/pull/651