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

string variable incorrectly stringified #51

Closed
gregal opened this issue Jun 22, 2023 · 2 comments
Closed

string variable incorrectly stringified #51

gregal opened this issue Jun 22, 2023 · 2 comments

Comments

@gregal
Copy link

gregal commented Jun 22, 2023

Expected Behaviour

When passing a string variable to runPersistedQuery, variablesString should be formatted without underquoting it.

Example:

const variables = { slug: 'aaa' }
await aemHeadlessClient.runPersistedQuery(path, variables)

variablesString should finally be assigned:

';slug=aaa'

as it is under @adobe/[email protected].

Actual Behaviour

variablesString is assigned:

';slug="aaa"'

...with the extra double quotes. Apparently, a bug introduced in #41.

Reproduce Scenario (including but not limited to)

Steps to Reproduce

Platform and Version

@adobe/[email protected] and 3.3.1

Sample Code that illustrates the problem

Logs taken while reproducing problem

@cpilsworth
Copy link
Contributor

I think this problem was introduced in #50 here
Its correct for an object

JSON.stringify({hello: "world"}) == '{"hello":"world"}'

but not for a simple string value

JSON.stringify("hello") == '"hello"'

cpilsworth added a commit to cpilsworth/aem-headless-client-js that referenced this issue Jul 22, 2023
@petergray-maker
Copy link

petergray-maker commented Aug 28, 2023

This is also affecting my project, it looks like the PR #53 is all good to be merged? Can it please be applied ?

Cheers

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

No branches or pull requests

3 participants