I’m trying to use httprepl to test endpoints in my ASP.NET app. When I tried to run a POST request my Command Prompt returned:
The default editor must be configured using the command `pref set editor.command.default "{commandLine}"`.
So I set it with the following command:
pref set editor.command.default "C:UsersUserAppDataLocalProgramsMicrosoft VS CodeCode.exe"
Then I get a warning:
If your default editor is Visual Studio Code, you should set the default command arguments (`editor.command.default.arguments`) to include `-w` or `--wait` to ensure proper integration between HttpRepl and Visual Studio Code.
I don’t know what to do at this point. I tried:
pref set editor.command.default.arguments "-w"
I’m not sure whether that worked or not, but when I try to repeat the command to set VS Code as my default editor, I get the same warning. Have I got that right?
4
Answers
This answer is based on a nodejs via httprepl setup
I think you might have already figured it out. However, since I got the same error (using nodejs and httprepl instead), I just post my answer for others’ reference. For me, it had nothing to do with the "default editor", I only need to add
-c "{}"
afterpost
.the -c provides an (empty in this case) inline HTTP request body. you may also provide some other stuff like:
-c "{"id":2,"name":"Cherry"}"
according to thisFor the backend I use nodejs and express, and noted that I have to add
express.json()
for it to workYes, you’ve got that right. I did the same (with "–wait" instead of "-w") and it worked well.
Test web APIs with the HttpRepl
Set vscode to your default editor that command is:
then you should set the editor.command.default.arguments key like this:
additional, you should add "–wait" or "-w" to the argument like this:
use this command to brower what preferences you have setted:
finally don’t forget restart you vscode!!!
If you are in an Ubuntu environment, try this one:
It worked for me pretty well.