Search code examples
resthttpgethttpie

HTTPie not recognizing second parameter of GET request


When I type in http GET localhost/api/data?param1=3&param2=7 I get a response that indicates the second parameter doesn't exist. I'm attempting to test my REST api and cannot figure out why the second parameter isn't recognized when using HTTPie.

There is no information on this in the documentation or online.


Solution

  • The solution has to do with how HTTPie parses ampersands. The ampersand splits the command, so you have to pass the value for the URL as a string by surrounding it with quotes. Example:

    http GET "localhost/api/data?param1=3&param2=7"
    

    This let's HTTPie know that the entire string is to be used for the URL and not just the portion before the & symbol.