Skip to content

Invalid request payload JSON format 2 #600

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

Closed
DyncKevin opened this issue Jul 12, 2018 · 0 comments
Closed

Invalid request payload JSON format 2 #600

DyncKevin opened this issue Jul 12, 2018 · 0 comments

Comments

@DyncKevin
Copy link

你新增的文档 https://github.com/qiniu/logkit/wiki/Http-Sender 我看过了,还是不行。你们这个http发送的json并不是标准的json吧,我用express接收,body-parser 解析不了。
虽然每一个模块是json对象,但一起发送的时候就不是了。
另外,发送的请求中,contentencoding为什么是json,一般都是identity阿

另外,我自己测试的,
将发送的bodydata做如下处理:
strData := strings.Join(dataArray, ",")
byteData = make([]byte, len(strData)+2)
copy(byteData, "[")
copy(byteData[1:], strData[:])
byteData[1+len(strData)] = ']'
转换成数组的json,并且将req.Header.Set(ContentEncodingHeader, "json")改为“identity”
服务端才可以正常接收
麻烦你们看一下,谢谢

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

1 participant