小编uko*_*ath的帖子

尝试通过HTTPS传递swagger.json时出现"没有规范提供"错误

如果我尝试通过HTTPS使用Flask RestPlus提供Swagger UI,我只会在根URL上看到"No spec provided"错误消息,并且从不加载完整的Swagger UI.但是,如果我访问API端点,则会按预期返回响应.

查看错误页面的源HTML,我注意到它swagger.json是从而http://myhost/不是https://myhost/

在restplus Github问题上发现了完全相同的问题

我已经用该页面上提到的猴子补丁暂时解决了我的问题.Swagger UI加载,并查看我看到swagger.json确实从中获取的HTML源代码https://myhost.

为什么会发生这种情况,如何在没有猴子补丁的情况下修复它?

HTTPS是由Cloudflare的"灵活"HTTPS服务提供的.

我的应用程序是Nginx背后的配置因此,并且我没有引起任何问题,据我所知:

...
http {
  ...
  server {
    location / {
      charset UTF-8;
      try_files $uri @proxy_to_app;
    }
    location @proxy_to_app {
      charset UTF-8;
      proxy_intercept_errors on;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header X-Forwarded-Proto $scheme;
      proxy_set_header Host $http_host;
      proxy_redirect off;
      proxy_pass http://127.0.0.1:5000;
    }
  }
}
Run Code Online (Sandbox Code Playgroud)

swagger flask-restplus

8
推荐指数
2
解决办法
2533
查看次数

生产中的Flask-oauthlib或authlib?

我刚刚在我正在建设的网站上工作了flask-oauthlib.但是,我注意到项目的首页有一个警告,要求使用authlib.

如果您在生产中使用flask-oauthlib,您是否计划迁移到authlib?是否有人知道这个迁移已完成的简单项目回购?我非常欣赏一些东西.

flask-oauthlib页面,注意警告:

https://flask-oauthlib.readthedocs.io/en/latest/

flask flask-oauthlib authlib

3
推荐指数
1
解决办法
1770
查看次数

对样式化组件进行预先处理会导致浏览器控制台出现错误

仅导入样式化组件会在浏览器控制台中导致此错误:

styled-components.browser.esm.js?face:1670 Uncaught TypeError: (0 , _react.createContext) is not a function
    at Object.eval (styled-components.browser.esm.js?face:1670)
    at eval (styled-components.browser.esm.js:2490)
    at Object../node_modules/styled-components/dist/styled-components.browser.esm.js (vendors~index.js:167)
    at __webpack_require__ (index.js:79)
    at eval (index.js?12d5:2)
    at Object../src/index.js (index.js:165)
    at __webpack_require__ (index.js:79)
    at checkDeferredModules (index.js:46)
    at index.js:152
    at index.js:155
Run Code Online (Sandbox Code Playgroud)

我正在使用webpack,preact,Babel。

在新的空构建中,要重现的代码实际上就是这样:

src / index.js:

styled-components.browser.esm.js?face:1670 Uncaught TypeError: (0 , _react.createContext) is not a function
    at Object.eval (styled-components.browser.esm.js?face:1670)
    at eval (styled-components.browser.esm.js:2490)
    at Object../node_modules/styled-components/dist/styled-components.browser.esm.js (vendors~index.js:167)
    at __webpack_require__ (index.js:79)
    at eval (index.js?12d5:2)
    at Object../src/index.js (index.js:165)
    at __webpack_require__ (index.js:79)
    at checkDeferredModules (index.js:46)
    at index.js:152 …
Run Code Online (Sandbox Code Playgroud)

webpack preact styled-components

3
推荐指数
1
解决办法
526
查看次数

在Facebook lint中,"未能获得作曲家模板数据"是什么意思?

我在Facebook上创建了一个简单的原型应用程序.当我的测试脚本(Ubuntu命令行上的JavaScript,由Node.js提供支持)尝试访问该应用程序时,它会生成以下错误消息:

{ error:
   { message: 'Invalid OAuth access token.',
     type: 'OAuthException',
     code: 190
   }
}
Run Code Online (Sandbox Code Playgroud)

所以我正在尝试使用Facebook的lint调试器进行调试.但是,当我将应用程序的访问令牌粘贴到lint时,它会响应:

Failed to get composer template data.

我不知道这意味着什么,并且通过谷歌漫长的绊倒揭示了一页又一页同样无能为力的人.

有谁见过这个错误,并修复了吗?

有关应用的详细信息:

它被配置为在标准权限的同时请求read_insights和manage_pages.没有请求其他权限.

设置,基本:我必须在安全画布URL中放置一个不存在的URL,因为我在任何地方都没有任何SSL托管.非SSL画布URL已完成,并指向现有页面.

"App Info"全部填写(除了Tagline是可选的).

我还没有提交该应用程序以供公众使用批准,并且没有"批准项目".我将成为唯一一个使用它的人,这对于这个应用程序来说不是必需的.

从"live"切换到"sandbox"再返回没有任何区别.

应用开发者页面上的任何位置都没有警告.

javascript facebook facebook-graph-api facebook-opengraph

2
推荐指数
1
解决办法
5263
查看次数