2
0
mirror of https://github.com/tenrok/axios.git synced 2026-06-20 20:00:40 +03:00

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
This commit is contained in:
Avindra Goolcharan
2019-09-07 08:05:26 -04:00
committed by Felipe Martins
parent a11cdf4683
commit 6a4a85c57f
12 changed files with 44 additions and 27 deletions
+6 -3
View File
@@ -9,17 +9,21 @@ Fixes and Functionality:
- Makes Axios error generic to use AxiosResponse ([#1738](https://github.com/axios/axios/pull/1738)) - Suman Lama - 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 - 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 - 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 - 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 `#` - 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 - 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 - 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 - 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 - Fix failing SauceLabs tests by updating configuration - Emily Morehouse
- Add issue templates - Emily Morehouse
Documentation: 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 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 - 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 - 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 - 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 - 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 - 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 - 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 - 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 - Clarify in README that default timeout is 0 (no timeout) ([#1750](https://github.com/axios/axios/pull/1750)) - Ben Standefer
+2 -2
View File
@@ -1,8 +1,8 @@
# Cookbook # 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 ### Promise.prototype.done
+21 -10
View File
@@ -4,23 +4,34 @@ This is a list of axios related libraries and resources. If you have a suggestio
## Libraries ## Libraries
* [react-hooks-axios](https://github.com/use-hooks/react-hooks-axios) - Custom React Hooks for Axios.js ### General
* [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
* [axios-vcr](https://github.com/nettofarah/axios-vcr) - 📼 Record and Replay Axios requests * [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 * [@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 * [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-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. * [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-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-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 * [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) * [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. * [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
+1 -1
View File
@@ -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 ```js
axios.get('/user/12345', { axios.get('/user/12345', {
+1 -1
View File
@@ -2,7 +2,7 @@
<html> <html>
<head> <head>
<title>axios - all example</title> <title>axios - all example</title>
<link rel="stylesheet" type="text/css" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css"/> <link rel="stylesheet" type="text/css" href="//maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"/>
</head> </head>
<body class="container"> <body class="container">
<h1>axios.all</h1> <h1>axios.all</h1>
+1 -1
View File
@@ -2,7 +2,7 @@
<html> <html>
<head> <head>
<title>AMD</title> <title>AMD</title>
<link rel="stylesheet" type="text/css" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css"/> <link rel="stylesheet" type="text/css" href="//maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"/>
</head> </head>
<body class="container"> <body class="container">
<h1>AMD</h1> <h1>AMD</h1>
+1 -1
View File
@@ -2,7 +2,7 @@
<html> <html>
<head> <head>
<title>axios - get example</title> <title>axios - get example</title>
<link rel="stylesheet" type="text/css" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css"/> <link rel="stylesheet" type="text/css" href="//maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"/>
</head> </head>
<body class="container"> <body class="container">
<h1>axios.get</h1> <h1>axios.get</h1>
+1 -1
View File
@@ -2,7 +2,7 @@
<html> <html>
<head> <head>
<title>axios - post example</title> <title>axios - post example</title>
<link rel="stylesheet" type="text/css" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css"/> <link rel="stylesheet" type="text/css" href="//maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"/>
</head> </head>
<body class="container"> <body class="container">
<h1>axios.post</h1> <h1>axios.post</h1>
+7 -4
View File
@@ -1,5 +1,4 @@
var fs = require('fs'); var fs = require('fs');
var url = require('url');
var path = require('path'); var path = require('path');
var http = require('http'); var http = require('http');
var argv = require('minimist')(process.argv.slice(2)); var argv = require('minimist')(process.argv.slice(2));
@@ -10,7 +9,7 @@ function listDirs(root) {
var files = fs.readdirSync(root); var files = fs.readdirSync(root);
var dirs = []; var dirs = [];
for (var i=0, l=files.length; i<l; i++) { for (var i = 0, l = files.length; i < l; i++) {
var file = files[i]; var file = files[i];
if (file[0] !== '.') { if (file[0] !== '.') {
var stat = fs.statSync(path.join(root, file)); var stat = fs.statSync(path.join(root, file));
@@ -105,7 +104,7 @@ server = http.createServer(function (req, res) {
if (/\/$/.test(url)) { if (/\/$/.test(url)) {
url += 'index.html'; url += 'index.html';
} }
// Format request /get -> /get/index.html // Format request /get -> /get/index.html
var parts = url.split('/'); var parts = url.split('/');
if (dirs.indexOf(parts[parts.length - 1]) > -1) { 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);
+1 -1
View File
@@ -2,7 +2,7 @@
<html> <html>
<head> <head>
<title>axios - transform response example</title> <title>axios - transform response example</title>
<link rel="stylesheet" type="text/css" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css"/> <link rel="stylesheet" type="text/css" href="//maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"/>
</head> </head>
<body class="container"> <body class="container">
<h1>transformResponse</h1> <h1>transformResponse</h1>
+1 -1
View File
@@ -2,7 +2,7 @@
<html> <html>
<head> <head>
<title>axios - file upload example</title> <title>axios - file upload example</title>
<link rel="stylesheet" type="text/css" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css"/> <link rel="stylesheet" type="text/css" href="//maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"/>
</head> </head>
<body class="container"> <body class="container">
<h1>file upload</h1> <h1>file upload</h1>
+1 -1
View File
@@ -2,7 +2,7 @@
<html> <html>
<head> <head>
<title>axios</title> <title>axios</title>
<link rel="stylesheet" type="text/css" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css"/> <link rel="stylesheet" type="text/css" href="//maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"/>
<style type="text/css"> <style type="text/css">
pre { pre {
max-height: 200px; max-height: 200px;