How can I remove leading and trailing double-quotes from a variable in JSR233 Postprocessor?

ohaya <[email protected]> Tue, 24 Sep 2024 21:22:21 +0000 (UTC)
Newsgroups gmane.comp.jakarta.jmeter.user
Message-ID <[email protected]>
Hi,
I am working on a test plan where I send a POST request to authenticate, and I get a token in the response.
Then, I need to send the token in GET request to get authorized.
The problem I am having is that the the response I am getting to the POST has the token surrounded by double-quotes (a double-quote in the front, and a double-quote, or possibly a double-quote followed by a blank/space) and I think that the double-quotes are causing the error.
I am extracting the token in a JSR233 Postprocessor with the following script:
vars.put("response", prev.getResponseDataAsString());Can I remove the leading double-quote and the trailing double-quote (or possibly trailing double-quote+space in the same Postprocessor, and if so how can I do that?
Thanks,Jim