From 6a4a85c57fcaba912eee61b87ba34d07323bc60c Mon Sep 17 00:00:00 2001 From: Avindra Goolcharan Date: Sat, 7 Sep 2019 08:05:26 -0400 Subject: [PATCH] Doc fixes, minor examples cleanup (#2198) * README.md COOKBOOK.md: minor fixes * simplify language * ECOSYSTEM: create a few categories * Examples: log port listening to * upgrade bootstrap 3 -> 4 in examples bootstrap 4 is slightly smaller then 3.2.0 so it should also help load examples faster * categorize 0.19 items a little differently surface user/consumer changes first --- CHANGELOG.md | 9 +++++--- COOKBOOK.md | 4 ++-- ECOSYSTEM.md | 31 +++++++++++++++++--------- README.md | 2 +- examples/all/index.html | 2 +- examples/amd/index.html | 2 +- examples/get/index.html | 2 +- examples/post/index.html | 2 +- examples/server.js | 11 +++++---- examples/transform-response/index.html | 2 +- examples/upload/index.html | 2 +- sandbox/client.html | 2 +- 12 files changed, 44 insertions(+), 27 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3632e0c..c802ccf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,17 +9,21 @@ Fixes and Functionality: - Makes Axios error generic to use AxiosResponse ([#1738](https://github.com/axios/axios/pull/1738)) - Suman Lama - Fixing Mocha tests by locking follow-redirects version to 1.5.10 ([#1993](https://github.com/axios/axios/pull/1993)) - grumblerchester - Allow uppercase methods in typings. ([#1781](https://github.com/axios/axios/pull/1781)) - Ken Powers -- Fixing .eslintrc without extension ([#1789](https://github.com/axios/axios/pull/1789)) - Manoel -- Consistent coding style ([#1787](https://github.com/axios/axios/pull/1787)) - Ali Servet Donmez - Fixing building url with hash mark ([#1771](https://github.com/axios/axios/pull/1771)) - Anatoly Ryabov - This commit fix building url with hash map (fragment identifier) when parameters are present: they must not be added after `#`, because client cut everything after `#` - Preserve HTTP method when following redirect ([#1758](https://github.com/axios/axios/pull/1758)) - Rikki Gibson - Add `getUri` signature to TypeScript definition. ([#1736](https://github.com/axios/axios/pull/1736)) - Alexander Trauzzi - Adding isAxiosError flag to errors thrown by axios ([#1419](https://github.com/axios/axios/pull/1419)) - Ayush Gupta + +Internal: + +- Fixing .eslintrc without extension ([#1789](https://github.com/axios/axios/pull/1789)) - Manoel - Fix failing SauceLabs tests by updating configuration - Emily Morehouse +- Add issue templates - Emily Morehouse Documentation: +- Consistent coding style in README ([#1787](https://github.com/axios/axios/pull/1787)) - Ali Servet Donmez - Add information about auth parameter to README ([#2166](https://github.com/axios/axios/pull/2166)) - xlaguna - Add DELETE to list of methods that allow data as a config option ([#2169](https://github.com/axios/axios/pull/2169)) - Daniela Borges Matos de Carvalho - Update ECOSYSTEM.md - Add Axios Endpoints ([#2176](https://github.com/axios/axios/pull/2176)) - Renan @@ -30,7 +34,6 @@ Documentation: - Clarify what values responseType can have in Node ([#2121](https://github.com/axios/axios/pull/2121)) - Tyler Breisacher - docs(ECOSYSTEM): add axios-api-versioning ([#2020](https://github.com/axios/axios/pull/2020)) - Weffe - It seems that `responseType: 'blob'` doesn't actually work in Node (when I tried using it, response.data was a string, not a Blob, since Node doesn't have Blobs), so this clarifies that this option should only be used in the browser -- Add issue templates - Emily Morehouse - Update README.md. - Add Querystring library note ([#1896](https://github.com/axios/axios/pull/1896)) - Dmitriy Eroshenko - Add react-hooks-axios to Libraries section of ECOSYSTEM.md ([#1925](https://github.com/axios/axios/pull/1925)) - Cody Chan - Clarify in README that default timeout is 0 (no timeout) ([#1750](https://github.com/axios/axios/pull/1750)) - Ben Standefer diff --git a/COOKBOOK.md b/COOKBOOK.md index 3e719b4..3f4debd 100644 --- a/COOKBOOK.md +++ b/COOKBOOK.md @@ -1,8 +1,8 @@ # Cookbook -In an effort to keep axios as light weight as possible, and to avoid a rats nest of code for supporting every possible integration, it is often necessary to say no to feature requests. This doesn't mean that those use cases aren't legitimate, but rather that they are easily supported by augmenting axios with other libraries. +This cookbook contains recipes for some commonly requested features. -The following are the recipes for some of the commonly requested features. +In order to keep axios as lightweight as possible, it is often necessary to say no to feature requests. Many of these use cases can be supported by augmenting axios with other libraries. ### Promise.prototype.done diff --git a/ECOSYSTEM.md b/ECOSYSTEM.md index 77bf978..b9595d2 100644 --- a/ECOSYSTEM.md +++ b/ECOSYSTEM.md @@ -4,23 +4,34 @@ This is a list of axios related libraries and resources. If you have a suggestio ## Libraries -* [react-hooks-axios](https://github.com/use-hooks/react-hooks-axios) - Custom React Hooks for Axios.js -* [moxios](https://github.com/axios/moxios) - Mock axios requests for testing -* [axios-response-logger](https://github.com/srph/axios-response-logger) - Axios interceptor which logs responses -* [axios-mock-adapter](https://github.com/ctimmerm/axios-mock-adapter) — Axios adapter that allows to easily mock requests -* [redux-axios-middleware](https://github.com/svrcekmichal/redux-axios-middleware) - Redux middleware for fetching data with axios HTTP client +### General + * [axios-vcr](https://github.com/nettofarah/axios-vcr) - 📼 Record and Replay Axios requests * [@3846masa/axios-cookiejar-support](https://github.com/3846masa/axios-cookiejar-support) - Add tough-cookie support to axios -* [axios-debug-log](https://github.com/Gerhut/axios-debug-log) - Axios interceptor of logging requests & responses by debug. * [axios-method-override](https://github.com/jacobbuck/axios-method-override) - Axios http request method override plugin -* [mocha-axios](https://github.com/jdrydn/mocha-axios) - Streamlined integration testing with Mocha & Axios -* [axiosist](https://github.com/Gerhut/axiosist) - Axios based supertest: convert node.js request handler to axios adapter, used for node.js server unit test. * [axios-cache-plugin](https://github.com/jin5354/axios-cache-plugin) - Help you cache GET request when using axios. * [axios-extensions](https://github.com/kuitos/axios-extensions) - A collection of axios extensions, including throttle and cache GET request plugin. -* [redux-saga-requests](https://github.com/klis87/redux-saga-requests) - Redux-Saga addon to simplify handling of AJAX requests. * [axios-fetch](https://github.com/lifeomic/axios-fetch) - A WebAPI Fetch implementation backed by an Axios client -* [axios-curlirize](https://www.npmjs.com/package/axios-curlirize) - Logs axios requests as curl commands, also adds a property to the response object with the curl command as value. * [axios-actions](https://github.com/davestewart/axios-actions) - Bundle endpoints as callable, reusable services * [axios-api-versioning](https://weffe.github.io/axios-api-versioning) - Add easy to manage api versioning to axios * [r2curl](https://github.com/uyu423/r2curl) - Extracts the cURL command string from the Axios object. (AxiosResponse, AxiosRequestConfig) * [axios-endpoints](https://github.com/renancaraujo/axios-endpoints) - Axios endpoints helps you to create a more concise endpoint mapping with axios. + +### Logging and debugging + +* [axios-response-logger](https://github.com/srph/axios-response-logger) - Axios interceptor which logs responses +* [axios-debug-log](https://github.com/Gerhut/axios-debug-log) - Axios interceptor of logging requests & responses by debug. +* [axios-curlirize](https://www.npmjs.com/package/axios-curlirize) - Logs axios requests as curl commands, also adds a property to the response object with the curl command as value. + +### React and redux + +* [react-hooks-axios](https://github.com/use-hooks/react-hooks-axios) - Custom React Hooks for Axios.js +* [redux-saga-requests](https://github.com/klis87/redux-saga-requests) - Redux-Saga addon to simplify handling of AJAX requests. +* [redux-axios-middleware](https://github.com/svrcekmichal/redux-axios-middleware) - Redux middleware for fetching data with axios HTTP client + +### Unit testing + +* [axiosist](https://github.com/Gerhut/axiosist) - Axios based supertest: convert node.js request handler to axios adapter, used for node.js server unit test. +* [axios-mock-adapter](https://github.com/ctimmerm/axios-mock-adapter) — Axios adapter that allows to easily mock requests +* [moxios](https://github.com/axios/moxios) - Mock axios requests for testing +* [mocha-axios](https://github.com/jdrydn/mocha-axios) - Streamlined integration testing with Mocha & Axios \ No newline at end of file diff --git a/README.md b/README.md index f17e2a5..3c7d721 100755 --- a/README.md +++ b/README.md @@ -538,7 +538,7 @@ axios.get('/user/12345') }); ``` -You can define a custom HTTP status code error range using the `validateStatus` config option. +Using the `validateStatus` config option, you can define HTTP code(s) that should throw an error. ```js axios.get('/user/12345', { diff --git a/examples/all/index.html b/examples/all/index.html index 4e817db..caaafdc 100644 --- a/examples/all/index.html +++ b/examples/all/index.html @@ -2,7 +2,7 @@ axios - all example - +

axios.all

diff --git a/examples/amd/index.html b/examples/amd/index.html index 60471d2..1b10d2b 100644 --- a/examples/amd/index.html +++ b/examples/amd/index.html @@ -2,7 +2,7 @@ AMD - +

AMD

diff --git a/examples/get/index.html b/examples/get/index.html index dc8e51b..8643323 100644 --- a/examples/get/index.html +++ b/examples/get/index.html @@ -2,7 +2,7 @@ axios - get example - +

axios.get

diff --git a/examples/post/index.html b/examples/post/index.html index 11f9ce3..43914a1 100644 --- a/examples/post/index.html +++ b/examples/post/index.html @@ -2,7 +2,7 @@ axios - post example - +

axios.post

diff --git a/examples/server.js b/examples/server.js index 525fb63..dab1c04 100644 --- a/examples/server.js +++ b/examples/server.js @@ -1,5 +1,4 @@ var fs = require('fs'); -var url = require('url'); var path = require('path'); var http = require('http'); var argv = require('minimist')(process.argv.slice(2)); @@ -10,7 +9,7 @@ function listDirs(root) { var files = fs.readdirSync(root); var dirs = []; - for (var i=0, l=files.length; i /get/index.html var parts = url.split('/'); if (dirs.indexOf(parts[parts.length - 1]) > -1) { @@ -134,4 +133,8 @@ server = http.createServer(function (req, res) { } }); -server.listen(argv.p || 3000); +const PORT = argv.p || 3000; + +server.listen(PORT); + +console.log("Examples running on " + PORT); diff --git a/examples/transform-response/index.html b/examples/transform-response/index.html index be95d2c..36dd26a 100644 --- a/examples/transform-response/index.html +++ b/examples/transform-response/index.html @@ -2,7 +2,7 @@ axios - transform response example - +

transformResponse

diff --git a/examples/upload/index.html b/examples/upload/index.html index f34386f..c26b41f 100644 --- a/examples/upload/index.html +++ b/examples/upload/index.html @@ -2,7 +2,7 @@ axios - file upload example - +

file upload

diff --git a/sandbox/client.html b/sandbox/client.html index ee59ad8..55051c2 100644 --- a/sandbox/client.html +++ b/sandbox/client.html @@ -2,7 +2,7 @@ axios - +