GithubHelp home page GithubHelp logo

errors's People

Watchers

 avatar  avatar

errors's Issues

【axios】provisional headers are shown

错误信息

使用axios进行post请求失败时会出现如下错误:

provisional headers are shown

原因剖析

请求头丢失所致,源码(见参考资料)15~17行,会删除Content-Type

if (utils.isFormData(requestData)) {
  delete requestHeaders['Content-Type']; // Let the browser set it
}

解决方案

给axios增加一个Content-Type的请求头(全局设置,或者单独某次请求设置)

axios.defaults.headers['Content-Type'] = 'application/x-www-form-urlencoded;charset=UTF-8';

参考资料

https://github.com/axios/axios/blob/a9831131c307a050a27d29d75925d7d4ad162da5/lib/adapters/xhr.js

【Node&Mysql】ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol requested by server; consider upgrading MySQL client

错误信息

使用node连接MySQL时会出现如下错误:

ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol requested by server; consider upgrading MySQL client

原因剖析

通过SQL命令查看

select user,plugin from mysql.user where user='YourUsername'

发现MySQL的登陆用户plugin信息如下:

user plugin
test auth_socket

登陆用户的plugin为非mysql_native_password(比如auth_socket

解决方案

修改pluginmysql_native_password

alter user 'YourUsername'@'%' identified with mysql_native_password by 'YourUserPassword';

或者创建时就设置pluginmysql_native_password

create user 'YourUsername'@'%' identified with mysql_native_password by 'YourUserPassword';

最后刷新

flush privileges;

参考资料

https://stackoverflow.com/questions/50093144/mysql-8-0-client-does-not-support-authentication-protocol-requested-by-server

【Browser】Unable to preventDefault inside passive event listener due to target being treated as passive

错误信息

Unable to preventDefault inside passive event listener due to target being treated as passive.

原因剖析

addEventListener的第三个参数可以为Boolean类型的useCapture也可以是Object类型的options,options有如下参数:

{
    capture:  Boolean,// 表示 listener 会在该类型的事件捕获阶段传播到该 EventTarget 时触发。
    once:  Boolean,// 表示 listener 在添加之后最多只调用一次。如果是 true, listener 会在其被调用之后自动移除。
    passive: Boolean,// 表示 listener 永远不会调用 preventDefault()。如果 listener 仍然调用了这个函数,客户端将会忽略它并抛出一个控制台警告。
    mozSystemGroup: Boolean // 只能在 XBL 或者是 Firefox' chrome 使用,这是个 Boolean,表示 listener 被添加到 system group。
}

注意从Chrome 56开始浏览器会给document绑定的touchmove/touchstart事件监听器的passive参数默认设置为true以提高性能

解决方案

  1. 去掉不必要的preventDefault
  2. 将第三各参数中的passive设置为false

参考资料

https://developer.mozilla.org/zh-CN/docs/Web/API/EventTarget/addEventListener
https://www.chromestatus.com/feature/5093566007214080

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.