dahong
dahong copied to clipboard
个人技术随笔
Bumps [lodash](https://github.com/lodash/lodash) from 4.17.11 to 4.17.21. Commits f299b52 Bump to v4.17.21 c4847eb Improve performance of toNumber, trim and trimEnd on large input strings 3469357 Prevent command injection through _.template's variable...
Bumps [ssri](https://github.com/npm/ssri) from 6.0.1 to 6.0.2. Changelog Sourced from ssri's changelog. 6.0.2 (2021-04-07) Bug Fixes backport regex change from 8.0.1 (b30dfdb), closes #19 Commits b7c8c7c chore(release): 6.0.2 b30dfdb fix: backport...
Bumps [elliptic](https://github.com/indutny/elliptic) from 6.4.1 to 6.5.4. Commits 43ac7f2 6.5.4 f4bc72b package: bump deps 441b742 ec: validate that a point before deriving keys e71b2d9 lib: relint using eslint 8421a01 build(deps): bump...
# 拦截器-interceptor 在现代的一些前端框架上,拦截器基本上是很基础但很重要的一环,比如Angular原生就支持拦截器配置,Axios也给我们提供了拦截器配置,那么拦截器到底是什么,它有什么用? > 拦截器字面上理解就是用来拦截的工具,一说到互联网上的拦截工具你应该立马能想到电脑的防火墙,对,拦截器的功能其实和防火墙一样,就是*拦截出站和入站的规则* 拦截器能帮助我们解决的 + 添加统一的request的参数 比如header中加入X-Requested-With,比如客户端需要实现sign和token的验证机制,比如你可以写$http.get('/files', params),拦截器帮你拼接成`http://www.xxxx.com/1/files`这样的请求地址 + 处理统一的responseError 比如重连机制,拿到error.code错误码重连,比如token过期,重新拿到token再次send request 比如统一报错信息,给所有返回的404来个提示也会很酷 + 等等 ## angular interceptor angular的interceptor是个数组,在`$httpProvider`中进行配置,一般写成一个config, 然后$httpProvider注入进来就可以配置了,把我们写的`interceptor`push进去就OK了,`$httpProvider.interceptors.push('interceptor')`,interceptor一般写成一个服务 ```javascript var interceptor = { 'request': function (config)...
Bumps [ini](https://github.com/isaacs/ini) from 1.3.5 to 1.3.7. Commits c74c8af 1.3.7 024b8b5 update deps, add linting 032fbaf Use Object.create(null) to avoid default object property hazards 2da9039 1.3.6 cfea636 better git push script,...
Bumps [http-proxy](https://github.com/http-party/node-http-proxy) from 1.17.0 to 1.18.1. Changelog Sourced from http-proxy's changelog. v1.18.1 - 2020-05-17 Merged Skip sending the proxyReq event when the expect header is present [#1447](https://github.com/http-party/node-http-proxy/issues/1447) Remove node6 support,...

Bumps [websocket-extensions](https://github.com/faye/websocket-extensions-node) from 0.1.3 to 0.1.4. Changelog Sourced from websocket-extensions's changelog. 0.1.4 / 2020-06-02 Remove a ReDoS vulnerability in the header parser (CVE-2020-7662, reported by Robert McLaughlin) Change license from...
## Plugin ### 类型 `(compiler) => {} | { apply: (compiler) => {} }` ## Loader ### 类型 `string` `some-loader | /loader.js` 两者之一
Bumps [acorn](https://github.com/acornjs/acorn) from 6.1.1 to 6.4.1. Commits 9a2e9b6 Mark version 6.4.1 90a9548 More rigorously check surrogate pairs in regexp validator df0cf1a Mark version 6.4.0 5303412 Also export Parser via Parser.acorn...