All Projects → ethanent → centra

ethanent / centra

Licence: MIT license
Core Node.js HTTP client

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to centra

Wretch
A tiny wrapper built around fetch with an intuitive syntax. 🍬
Stars: ✭ 2,285 (+4294.23%)
Mutual labels:  http-client, request, http-request
Gout
gout to become the Swiss Army Knife of the http client @^^@---> gout 是http client领域的瑞士军刀,小巧,强大,犀利。具体用法可看文档,如使用迷惑或者API用得不爽都可提issues
Stars: ✭ 749 (+1340.38%)
Mutual labels:  http-client, http-requests, request
Ky
🌳 Tiny & elegant JavaScript HTTP client based on the browser Fetch API
Stars: ✭ 7,047 (+13451.92%)
Mutual labels:  http-client, request, http-request
direwolf
Package direwolf is a convenient and easy to use http client written in Golang.
Stars: ✭ 44 (-15.38%)
Mutual labels:  http-client, http-requests
Frequest
FRequest - A fast, lightweight and opensource desktop application to make HTTP(s) requests
Stars: ✭ 130 (+150%)
Mutual labels:  http-client, http-requests
EthernetWebServer SSL
Simple TLS/SSL Ethernet WebServer, HTTP Client and WebSocket Client library for for AVR, Portenta_H7, Teensy, SAM DUE, SAMD21, SAMD51, STM32F/L/H/G/WB/MP1, nRF52 and RASPBERRY_PI_PICO boards using Ethernet shields W5100, W5200, W5500, ENC28J60 or Teensy 4.1 NativeEthernet/QNEthernet. It now supports Ethernet TLS/SSL Client. The library supports …
Stars: ✭ 40 (-23.08%)
Mutual labels:  http-client, http-requests
Got
🌐 Human-friendly and powerful HTTP request library for Node.js
Stars: ✭ 10,620 (+20323.08%)
Mutual labels:  http-client, http-request
oh-my-request
🔮 simple request library by java8
Stars: ✭ 41 (-21.15%)
Mutual labels:  http-client, request
httper
An asynchronous HTTP(S) client built on top of hyper.
Stars: ✭ 16 (-69.23%)
Mutual labels:  http-client, request
get-it
Composable HTTP request library for node and browsers
Stars: ✭ 19 (-63.46%)
Mutual labels:  http-client, request
puzzle-warden
🔌 Improved http client with epic features for creating fast and scalable applications.
Stars: ✭ 41 (-21.15%)
Mutual labels:  http-client, request
Baseokhttpv3
🔥OkHttp的二次封装库,提供各种快速使用方法以及更为方便的扩展功能。提供更高效的Json请求和解析工具以及文件上传下载封装,HTTPS和Cookie操作也更得心应手。
Stars: ✭ 121 (+132.69%)
Mutual labels:  http-client, request
1c http
Подсистема 1С для работы с HTTP
Stars: ✭ 48 (-7.69%)
Mutual labels:  http-client, http-requests
relay
Relay lets you write HTTP requests as easy to read, structured YAML and dispatch them easily using a CLI. Similar to tools like Postman
Stars: ✭ 22 (-57.69%)
Mutual labels:  http-client, http-requests
pawn-requests
pawn-requests provides an API for interacting with HTTP(S) JSON APIs.
Stars: ✭ 56 (+7.69%)
Mutual labels:  http-client, http-requests
Rxios
A RxJS wrapper for axios
Stars: ✭ 119 (+128.85%)
Mutual labels:  http-client, request
request-on-steroids
An HTTP client ✨ with retry, circuit-breaker and tor support 📦 out-of-the-box
Stars: ✭ 19 (-63.46%)
Mutual labels:  http-client, request
swish
C++ HTTP requests for humans
Stars: ✭ 52 (+0%)
Mutual labels:  http-client, http-requests
Oh My Request
🔮 simple request library by java8
Stars: ✭ 44 (-15.38%)
Mutual labels:  http-client, request
Http Client
A high-performance, high-stability, cross-platform HTTP client.
Stars: ✭ 86 (+65.38%)
Mutual labels:  http-client, request

The core lightweight HTTP client for Node

GitHub | NPM

Install

npm i centra

Why centra?

centra is the best request library for developers; it provides a number of extremely useful features while still being one of the most lightweight Node.js HTTP client libraries available.

Use centra!

First, require the library.

const c = require('centra')

Then let's make a request in an async function!

;(async () => {
	const res = await c('https://ethanent.me').send()

	console.log(await res.text())
})()

More advanced usage

Send data in a JSON body

c('https://example.com/nonexistentJSONAPI', 'POST').body({
	'name': 'Ethan'
}, 'json').send().then((res) => {
	/*...*/
})

Send data in a form body

c('https://example.com/nonexistentJSONAPI', 'POST').body({
	'name': 'Ethan'
}, 'form').send().then((res) => {
	/*...*/
})

Set query string parameters

One at a time:

c('https://example.com/user').query('id', 'u1817760').send().then((res) => {
	/*...*/
})

Many at a time:

c('https://example.com/user').query({
	'id', 'u1817760',
	'name': 'Ethan'
}).send().then((res) => {
	/*...*/
})

Set a request timeout

c('https://ethanent.me').timeout(2000).send().then((res) => {
	// Success!
}).catch((err) => {
	// Has the request timed out?
})

Stream a request's response

In this example, the stream is piped to a file:

// require the fs module beforehand

c('https://ethanent.me/images/mainLogo.png').stream().send().then((stream) => stream.pipe(fs.createWriteStream(path.join(__dirname, 'logo.png'))))

Switch paths on the fly

c('https://ethanent.me/test').path('/hello').send()

// This will make a request to https://ethanent.me/test/hello

Specify request headers

One at a time:

c('https://ethanent.me').header('Content-Type', 'application/json').send()

Many at a time:

c('https://ethanent.me').header({
	'Content-Type': 'application/json',
	'X-Connecting-With': 'centra'
}).send()

Modify core HTTP request options

See http.request's options for more information about core HTTP request options. Let's change our localAddress as an example.

c('https://ethanent.me').option('localAddress', '127.0.0.2').send()

Accept compressed responses

c('https://ethanent.me').compress().send()

// This will cause centra to accept compressed content from the server. (gzip and deflate are currently supported)
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].