New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

httpc-comp6461

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

httpc-comp6461

httpc is a curl-like application but supports HTTP protocol only.

latest
npmnpm
Version
1.2.0
Version published
Maintainers
1
Created
Source

HTTPC

cURL like command Line Application and Network Protocol Software Library

httpc is a curl-like application but supports HTTP protocol only.

httpc installation

httpc requires Node.js to run.

Install the node dependencies and follow the below steps.

cd your-project-folder
npm i httpc-comp6461

httpc commands

Help:

httpc help
Usage :
 httpc command [arguments]
The commands are :
 get -> executes a HTTP GET request and prints the response.
 post -> executes a HTTP POST request and prints the response.
 help -> prints this screen.
Use "httpc help [command]" for more information about a command

Help command for Specific method

help for GET:

httpc help get
usage: httpc get [-v] [-h key:value] URL

Get -> executes a HTTP GET request for a given URL.

help for POST:

httpc help post
usage: httpc post [-v] [-h key:value] [-d inline-data] [-f file] URL

Post -> executes a HTTP POST request for a given URL with inline data or from file.

GET | DELETE

Get executes a HTTP GET request for a given URL.

Usage

 httpc get|delete [-v] [-h key:value] URL
FlagDescription
-vPrints the detail of the response such as protocol, status, and headers.
-h key:valueAssociates headers to HTTP Request with the format 'key:value'.
-pSpecifies the port number

POST | PUT

Post executes a HTTP POST request for a given URL with inline data or from file.

Usage

httpc post|put [-v] [-h key:value] [-d inline-data] [-f file] URL
FlagDescription
-vPrints the detail of the response such as protocol, status, and headers.
-h key:valueAssociates headers to HTTP Request with the format 'key:value'.
-pSpecifies the port number
-d stringAssociates an inline data to the body HTTP POST request.
-f fileAssociates the content of a file to the body HTTP POST request.
Either [-d] or [-f] can be used but not both.

EXAMPLES

GET with query parameters:

httpc get 'http://httpbin.org/get?course=networking&assignment=1'
Output:
{
 "args": {
 "assignment": "1",
 "course": "networking"
 },
 "headers": {
 "Host": "httpbin.org",
 "User-Agent": "Concordia-HTTP/1.0"
 },
 "url": "http://httpbin.org/get?course=networking&assignment=1"
}

GET with verbose option:

httpc get -v 'http://httpbin.org/get?course=networking&assignment=1'
Output:
HTTP/1.1 200 OK
Server: nginx
Date: Fri, 1 Sep 2017 14:52:12 GMT
Content-Type: application/json
Content-Length: 255
Connection: close
Access-Control-Allow-Origin: *
Access-Control-Allow-Credentials: true
{
 "args": {
 "assignment": "1",
 "course": "networking"
 },
 "headers": {
 "Host": "httpbin.org",
 "User-Agent": "Concordia-HTTP/1.0"
 },
 "url": "http://httpbin.org/get?course=networking&assignment=1"
}

Post with inline data:

httpc post -h Content-Type:application/json --d '{"Assignment": 1}' 
http://httpbin.org/post
Output:
{
 "args": {},
 "data": "{\"Assignment\": 1}",
 "files": {},
 "form": {},
 "headers": {
 "Content-Length": "17",
 "Content-Type": "application/json",
 "Host": "httpbin.org",
 "User-Agent": "Concordia-HTTP/1.0"
 },
 "json": {
 "Assignment": 1
 },
 "url": "http://httpbin.org/post"
}

Write response to specific file

httpc -v 'http://httpbin.org/get?course=networking&assignment=1' -o hello.txt

FAQs

Package last updated on 16 Oct 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts