While training on this article, I try, having raised the local server using express.js and the database using MongoDB, to send requests to my web application in the console via httpie . For very simple queries, it works.

But even in the example that is offered at the very httpie :

http www.google.com search=='HTTPie logo' tbm==isch 
  • The syntax error is already crashing. It seems to be connected with the search syntax of the argument: enter image description here

The same errors, of course, occur in more complex queries: enter image description here

Specifically, this problem of my "impromptu" is repaired, if you glue the arguments through the "+" (Joe + Doe, for example). But this is some kind of nonsense, not described in the documentation (if I search for it correctly and understand it correctly) and, besides, there are still problems with the syntax that cannot be fixed so easily. enter image description here

What's the matter? Why can't I send a request using the syntax described by the authors of httpie? I would like to get an answer strictly on the topic, maybe someone also uses httpie | json and knows the reason.

  • PS I could not add the httpie tag, because need a reputation. - Rumata Estorsky

1 answer 1

The examples are written in POSIX shell, and cmd.exe on Windows interprets single quotes differently. Just replace them with double ones.

 c:\> http :8888 search=="HTTPie logo" tbm==isch 

This will execute the query:

 c:\> py -mwebbrowser "http://localhost:8888/?search=HTTPie+logo&tbm=isch" 
  • Correction - cmd.exe does not accept quotes at all. On Windows, each program parses its own arguments as it wants. - Pavel Mayorov
  • @PavelMayorov is true — single quotes are all ignored in this case on Windows. But at first cmd sees the command, otherwise internal commands like dir and meta characters of type ^ would not work. And only then python uses the rules for c / c ++ programs (it depends on the compiler) to break the line into arguments . - jfs