http
http copied to clipboard
A janet http client library
http
A janet http client
Install
Add to your project.janet file
{:dependencies ["https://github.com/joy-framework/http"]}
Linux Dependencies
On Debian and Debian-like Linux distros, such as Ubuntu, you need libcurl4-openssl-dev --
sudo apt install libcurl4-openssl-dev
On Fedora, CentOS, and RHEL-like distros, you need libcurl-devel --
sudo dnf install libcurl-devel
Use
(import http)
Send get requests!
(= @{:status 200 :body "..." :headers {"Content-Type" "text/html; charset=UTF-8" ...}}
(http/get "example.com"))
... and post requests!
(http/post "example.com" "param1=value1¶m2=value2")
follow redirects!
(http/get "httpstat.us/302" :follow-redirects true)
send custom http methods too!
*head, trace, delete, put, and patch supported
(http/delete "example.com/accounts/1")
Specify a port:
(http/get "example.com:9001", ...)