..

lwp-request

Today, I learned about LWP (libwww-perl).

    ~ % POST https://httpbin.org/post
    Please enter content (application/x-www-form-urlencoded) to be POSTed:
    Foo
    Bar
    Blitz

    {
      "args": {}, 
      "data": "", 
      "files": {}, 
      "form": {
        "Foo\nBar\nBlitz\n": ""
      }, 
      "headers": {
        "Content-Length": "14", 
        "Content-Type": "application/x-www-form-urlencoded", 
        "Host": "httpbin.org", 
        "User-Agent": "lwp-request/6.61 libwww-perl/6.61", 
        "X-Amzn-Trace-Id": "Root=1-64b5a776-189327ac7eeb83ba7137f942"
      }, 
      "json": null, 
      "origin": "82.14.255.187", 
      "url": "https://httpbin.org/post"
    }

This makes for some cute shell scripts. I have a handful of shell scripts I use for housekeeping at work, and I’ll probably start using these for that. I don’t know how I’d never noticed it before. But where does it come from?

  ~ % which POST
  /usr/bin/POST
  ~ % file `which POST`
  /usr/bin/POST: symbolic link to lwp-request

lwp-request (1) (man page) is the utility that provides it. And it looks at $0 to infer the verb (github link).