---------- set bearer token----------- const token = pm.environment.get("TOKEN"); console.log(token) if (!token) { console.error("Token is not set in the environment."); throw new Error("Token is missing. Please set the token in the environment."); } pm.request.headers.add({ key: "Authorization", value: `Bearer ${token}` });
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter