I currently have a simple pre-request script to get a bearer token for my request. However, I keep getting this error every time I try to send the request
âThere was an error in evaluating the Pre-request Script:Error: No data, empty input at 1:1 ^â
Have a look at the request\response in the console log.
All requests including those triggered by sendRequest get logged.
Is it going through ok, are you getting any errors?
I suspect the request is not being authorised correct, and therefore the following line is erroring as it canât parse the response.
const jsonResponse = response.json();
You can create this as a normal Post request in Postman while you are troubleshooting it, and then setup as a pre-request script after you get it working.
Itâs easier to see the request\response that way.
I have obviously xxxxx out the sensitive data, but you can see the first like in the log at the bottom.
I suggest you take @michaelderekjones suggestion and build it as a normal Post request first, ensure that it works and you get a response, and then copy the info across to the pm.sendRequest() call.