Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

调用put fie 但响应状态吗为401 #41

Open
slince opened this issue Jun 7, 2018 · 4 comments
Open

调用put fie 但响应状态吗为401 #41

slince opened this issue Jun 7, 2018 · 4 comments

Comments

@slince
Copy link

slince commented Jun 7, 2018

response body:

{"msg":"need date header","code":40100001,"id":"fd9e0c412907109f04a169abaf5d7f5f"}   

控制台错误:

spread.js:25 Refused to set unsafe header "Date"
(anonymous) @ spread.js:25
v @ index.js:20
(anonymous) @ spread.js:25
e.exports @ spread.js:25
e.exports @ spread.js:25
spread.js:25 Refused to set unsafe header "User-agent"
(anonymous) @ spread.js:25
v @ index.js:20
(anonymous) @ spread.js:25
e.exports @ spread.js:25
e.exports @ spread.js:25

问下怎么解决此类问题;或者是说这个方法只适合服务端调用。

@binbinah
Copy link
Member

binbinah commented Jun 7, 2018

浏览器客户端 js 在会禁用 Date 这种字段,可以尝试一下用 "x-date" 字段试试。

另外, 客户端 js 的上传,安全起见,不建议使用 REST 接口进行上传的,您可以用 FORM 接口的 大文件模式:FORM 大文件上传

@slince
Copy link
Author

slince commented Jun 7, 2018

@binbinah

你好:

可以尝试一下用 "x-date" 字段试试。

报错中的date字段并不是我设置的,而是该sdk自己处理的;我是按照sample目录下的例子做的操作;

安全起见,不建议使用 REST 接口进行上传的,您可以用 FORM 接口的 大文件模式

我之前看官方文档看到过这篇,但文档是原理基础;请问有没有基于本sdk实现的案例或者代码演示。
我尝试用 formPutFile 方法上传但提示需要设置 setBodySignCallback ,这一部分有没有演示

谢谢!

@liu2080019
Copy link

解决了嘛。 服务端调用也是401

@sabakugaara
Copy link
Contributor

具体的环境和代码提供下,方便复现 @liu2080019

cc @zyvas

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants