skip to Main Content

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


  1. 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 "{}" after post.

    post -c "{}" -h Content-Type=application/json
    

    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 this

    For the backend I use nodejs and express, and noted that I have to add express.json() for it to work

    const Router = express.Router();
    Router.use(express.json())
    
    Router.post('/some/path/',async (request: Request, response: Response) => {
        console.log(reuqest.body)
        response.send('ok')
    })
    
    Login or Signup to reply.
  2. Yes, you’ve got that right. I did the same (with "–wait" instead of "-w") and it worked well.

    Login or Signup to reply.
  3. Test web APIs with the HttpRepl

    Set vscode to your default editor that command is:

    pref set editor.command.default "/Applications/Visual Studio Code.app/Contents/Resources/app/bin/code"
    

    then you should set the editor.command.default.arguments key like this:

    pref set editor.command.default.arguments "--disable-extensions --new-window"
    

    additional, you should add "–wait" or "-w" to the argument like this:

    pref set editor.command.default.arguments "--disable-extensions --new-window --wait"
    

    use this command to brower what preferences you have setted:

    pref get
    

    finally don’t forget restart you vscode!!!

    Login or Signup to reply.
  4. If you are in an Ubuntu environment, try this one:

    pref set editor.command.default /usr/bin/gedit
    

    It worked for me pretty well.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search