-
Notifications
You must be signed in to change notification settings - Fork 839
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
Raw body editor JSON comment #3358
Comments
@horacehylee You can add comments to raw body. Can you explain a bit more about the use case you are trying to achieve. |
@prashantagarwal Yes, we can add comments to raw body. But it shows red error highlight for JSON. |
@horacehylee The JSON schema (http://www.json.org/) does not support comments. Postman supports disabling parameters for form-data / urlencoded types, but cannot do so for JSON - the entire body is treated as the request payload. |
@abhijitkane yeah, but this is a testing tool, not a JSON validator, commenting out JSON could be a great tool for testing APIs, because is a pain to send many information using the form-data / urlencoded tool |
@abhijitkane I completely agree with @Bl4ckf4ll It would be a greate feature to allow comments in JSON editor. |
Still open as #3117. |
Agree totaly, we should have some kind of comments |
I need this one also 👍 |
+1 It would be great if we have this feature. |
+1 A must feature |
+1 Would be great to have this feature |
+1 looking for it as well |
+10086 |
Must implement |
+1 |
4 similar comments
+1 |
+1 |
+1 |
+1 |
You can trim all comments before sending JSON data, you just provide the handy way to present addditional information for new API users, who will use this method. Like some kind of specification. It can be separated field, but showed on screen at the same time with JSON data. Yeah, we have a @comments@ link at the right top corner, but it is absolutely not convinient! |
+1 |
2 similar comments
+1 |
+1 |
Could you be so king to show me how you mark comments? |
@silverjohnes |
I tried this but it failed (unfortunately): the logged data is ok but it seems that the body sent remains unchanged. |
@julienloizelet You're right, my method doesn't change the JSON. I thought it worked because my testing server can reformat JSON data, and forgot this. I'm trying to figure out why postman's pre-request script cannot update body. |
Hello everyone 👋 To temporarily unblock this, Postman v8.3.0 added support for programmatically mutating the request body. The following // Strip JSON Comments
if (pm.request.body.mode === 'raw') {
const rawData = pm.request.body.toString();
const strippedData = rawData.replace(/\\"|"(?:\\"|[^"])*"|(\/\/.*|\/\*[\s\S]*?\*\/)/g, (m, g) => g ? "" : m)
pm.request.body.raw = strippedData;
} Also, we'll soon add native support for this in the app. |
The code above changes Content-Type to pm.request.headers.add({key: 'Content-Type', value: 'application/json'}); to fix it. There is probably a simpler way but I did not figure it out. |
To uncomment the lines i use find "//" and replace in selection. It is anoying but better than comment out line by line. |
JSON text. |
+1 to this feature. For complicated legacy systems, I have the hardest time helping my QAs and new developers understand all the permutations of a payload. Bloating the pre-request scripts would only further add confusion. |
+1 to this feature, badly needed. In Postman, there is no good feature to document the request, so everybody would like to do it in the body. The Documentation panel is mostly useless. Is is very hard to notice / read anything you put in there because it displays a lot of other contents which is not about documenting the request. The Comments panel can only be used with Workspaces (which is a non-starter for us). |
+1 to this feature. Please fix the uppercasing issue. |
+1 to this. The form data ui would be perfect for this. Add a new raw-json tab and just have it spit out the raw json on selected variables rather than form data. Everything you need is there, type, description, key and value. Only thing that would need work is nested fields. You can document and optionally select variables with a click. |
Why refuse a feature that clearly many people want? @Kyreikal has a good solution here ^ |
+1 please fix uppercasing, it makes the uncomment feature more or less unusable |
+1 for this feature |
+1 |
1 similar comment
+1 |
I'm using |
Hello everyone 👋 |
The issue has returned "Postman v11.2.0" when using Ctrl+k+u to un-comment while selecting the text, the text transforming to uppercase after une-commented |
It would be great if request raw body editor can support comment, for easier testing
The text was updated successfully, but these errors were encountered: