22 February 2017 - Upkar Lidder Open Issue

Quick how to use curl command in the terminal

  1. Straight up curl

    curl https://www.google.com
    

    ![curl google]
    (../../img/curl/full-google.jpg)

  2. curl but only headers
    curl -I https://www.google.com



    HTTP/1.1 200 OK
    Date: Wed, 22 Feb 2017 23:49:33 GMT
    Expires: -1
    Cache-Control: private, max-age=0
    Content-Type: text/html; charset=ISO-8859-1
    P3P: CP="This is not a P3P policy! See https://www.google.com/support/accounts/answer/151657?hl=en for more info."
    Server: gws
    X-XSS-Protection: 1; mode=block
    X-Frame-Options: SAMEORIGIN
    Set-Cookie: NID=97=uf_GXb8Vbj3AkWwk2xXJOX9lC050BZz40wbIyg8aa1v_QJZpHm7Bvbu0831HPN0eGUbeSK5MIYV-ckXB-cFRDidnuerDbkz5xbbRZb79ZH9q0DCR03j6I487eiWxAaxQlDX0pRwp8WtYBKF-; expires=Thu, 24-Aug-2017 23:49:33 GMT; path=/; domain=.google.com; HttpOnly
    Alt-Svc: quic=":443"; ma=2592000; v="35,34"
    Transfer-Encoding: chunked
    Accept-Ranges: none
    Vary: Accept-Encoding

    That's better !

  3. Add new line to curl output
    If you are expecting json and use curl, it outputs the prompt next to the output. This is a little annoying. The endpoint below just returns "hello world".

        $ curl http://localhost:6007
    
        
            Hello Worldupkar@Upkars-MacBook-Pro ~/code-upkar/blog (curl)*
        
    

    If you add the following to ~/.curlrc, it adds a new line to the output
    -w "\n"
    Let's try again:
    $ curl http://localhost:6007

        
            $ curl http://localhost:6007
            Hello World
            upkar@Upkars-MacBook-Pro ~/code-upkar/blog (curl)
        
    

Open Issue

Back home