I am looking the Postman Shortcut panel but I don't see a shortcut to comment part of my code in a request body, it is very annoying to copy and paste <!-- comment-->
to make a comment.
According to the shortcut panel Ctrl + /
open the shortcut panel but I accidentally did it in the request body and it comments the line
For the Body, raw category, you can use the following:
- Ctrl + k + c (Will comment your selection)
- Ctrl + k + u (Will un-comment your selection but also Uppercase everything)
I did not found other way to uncomment than deleting all the // bars by hand
I also found a nice work around on this link https://www.youtube.com/watch?v=bX4-cLPcD2Q
This was a Feature Request to the PostMan team. 21 days ago someone has added a comment asking exactly to revert a comment with Ctrl + K + U and also reporting the upper case issue. Let's hope they fix this soon. https://github.com/postmanlabs/postman-app-support/issues/3358
UPDATE The Post Team has fixed this issue so now you can use:
- Ctrl + k + c (Will comment your selection)
- Ctrl + k + u (Will un-comment your selection)
Even if the previous youtube trick is still valid, chances are it is not necessary anymore to create a pre-request script.
I have tried in postman and the below worked form me.
ctrl + k + c (Comments the line)
ctrl + / (uncomments the line)
As of Postman version 9.31.0, if you select multiple rows Postman still makes uppercase whilst uncommenting, with the key combination: ctrl + k + u
Workaround 1: ctrl + ö shortcut works well with my TR keyboard, it should be ctrl + . with the EN keyboard.
Workaround 2: That does not happen with single-line uncommenting, but you need to repeat it for each line (a bit annoying)
Like it says above, if you add something like the below to your Pre-request Script tab, you can use either // or /* */ to comment out a line/section:
if(pm.request.body && pm.request.body.raw) pm.request.body.raw = pm.request.body.raw.replace(/\/\*[\s\S]*?\*\/|\/\/.*/g,'');
workaround
ctrl + k + c -> comment
ctrl + k + u -> uncomment and uppercase
ctrl + shift + u -> lowercase
© 2022 - 2024 — McMap. All rights reserved.
Ctrl + ~
– Sculpture