Skip to content

Commit

Permalink
docs: enhance features list & add nodesecure image
Browse files Browse the repository at this point in the history
  • Loading branch information
fraxken committed Aug 8, 2021
1 parent 63e617c commit 44236f6
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 53 deletions.
18 changes: 13 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,26 @@
# Httpie
[httpie](https://github.com/lukeed/httpie) "like" request wrapper that use new Node.js http client [undici](https://github.com/nodejs/undici) under the hood.

A modern and light Node.js http client 🐢🚀. The package is inspired by lukeed [httpie](https://github.com/lukeed/httpie) (The use is relatively similar). This package use new Node.js http client [undici](https://github.com/nodejs/undici) under the hood.

## Features

- Implement httpie features.
- Automatically handles JSON requests and responses.
- Includes aliases for common HTTP verbs: `get`, `post`, `put`, `patch`, and `del`.
- Able to automatically detect domains and paths to assign the right Agent (use a LRU cache to avoid repetitive computation).
- [**WIP**] Precise Rate-limit with the package `p-ratelimit`.
- [**WIP**] Allows to use an accurate rate-limiter like `p-ratelimit`.
- [**WIP**] Built-in retry mechanism with **custom policies**.

Thanks to undici:

- Support [HTTP redirections](https://developer.mozilla.org/en-US/docs/Web/HTTP/Redirections) with the `maxRedirections` argument
- Bare metal rate-limit protection by using Undici Agent maximum connections.
- Support [HTTP redirections](https://developer.mozilla.org/en-US/docs/Web/HTTP/Redirections) with the `maxRedirections` argument.
- Implement high-level API for undici **stream** and **pipeline** method.
- Optimization and performance of the new client (**around 2.5x faster** than Node.js native http client).
- Work well with **newest** Node.js API [AbortController](https://nodejs.org/dist/latest-v16.x/docs/api/globals.html#globals_class_abortcontroller) to cancel http request.

Light with seriously maintained dependencies:

![](./docs/images/nodesecure.PNG)

## Requirements
- [Node.js](https://nodejs.org/en/) version 14 or higher

Expand All @@ -37,6 +42,9 @@ The MyUnisoft httpie client is very similar to lukeed httpie http client.
import * as httpie from "@myunisoft/httpie";

try {
const { data } = await httpie.get("https://jsonplaceholder.typicode.com/posts");
console.log(data);

const response = await httpie.post("https://jsonplaceholder.typicode.com/posts", {
body: {
title: "foo",
Expand Down
Binary file added docs/images/nodesecure.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
99 changes: 51 additions & 48 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,48 +1,51 @@
{
"name": "@myunisoft/httpie",
"version": "1.0.0",
"description": "MyUnisoft Node.js HTTP client that use Undici client",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"scripts": {
"build": "tsc",
"prepublishOnly": "npm run build",
"test": "jest"
},
"repository": {
"type": "git",
"url": "git+https://github.com/MyUnisoft/httpie.git"
},
"keywords": [],
"files": [
"dist"
],
"publishConfig": {
"@myunisoft:registry": "https://registry.npmjs.org/"
},
"author": "GENTILHOMME Thomas <[email protected]>",
"license": "MIT",
"bugs": {
"url": "https://github.com/MyUnisoft/httpie/issues"
},
"homepage": "https://github.com/MyUnisoft/httpie#readme",
"devDependencies": {
"@myunisoft/eslint-config": "^1.3.2",
"@types/content-type": "^1.1.5",
"@types/jest": "^26.0.24",
"@types/lru-cache": "^5.1.1",
"@types/node": "^16.4.3",
"@types/statuses": "^2.0.0",
"dotenv": "^10.0.0",
"jest": "^27.0.6",
"p-ratelimit": "^1.0.1",
"ts-jest": "^27.0.4",
"typescript": "^4.3.5"
},
"dependencies": {
"content-type": "^1.0.4",
"lru-cache": "^6.0.0",
"statuses": "^2.0.1",
"undici": "^4.3.1"
}
}
{
"name": "@myunisoft/httpie",
"version": "1.0.0",
"description": "MyUnisoft Node.js HTTP client that use Undici client",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"scripts": {
"build": "tsc",
"prepublishOnly": "npm run build",
"test": "jest"
},
"repository": {
"type": "git",
"url": "git+https://github.com/MyUnisoft/httpie.git"
},
"engines": {
"node": ">=14"
},
"keywords": [],
"files": [
"dist"
],
"publishConfig": {
"@myunisoft:registry": "https://registry.npmjs.org/"
},
"author": "GENTILHOMME Thomas <[email protected]>",
"license": "MIT",
"bugs": {
"url": "https://github.com/MyUnisoft/httpie/issues"
},
"homepage": "https://github.com/MyUnisoft/httpie#readme",
"devDependencies": {
"@myunisoft/eslint-config": "^1.3.2",
"@types/content-type": "^1.1.5",
"@types/jest": "^26.0.24",
"@types/lru-cache": "^5.1.1",
"@types/node": "^16.4.3",
"@types/statuses": "^2.0.0",
"dotenv": "^10.0.0",
"jest": "^27.0.6",
"p-ratelimit": "^1.0.1",
"ts-jest": "^27.0.4",
"typescript": "^4.3.5"
},
"dependencies": {
"content-type": "^1.0.4",
"lru-cache": "^6.0.0",
"statuses": "^2.0.1",
"undici": "^4.3.1"
}
}

0 comments on commit 44236f6

Please sign in to comment.