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

[Feature] multipart/form-data encoding #2257

Closed
czyt opened this issue Aug 5, 2022 · 2 comments
Closed

[Feature] multipart/form-data encoding #2257

czyt opened this issue Aug 5, 2022 · 2 comments
Labels

Comments

@czyt
Copy link
Contributor

czyt commented Aug 5, 2022

for current version kratos display error

{
    "code": 400,
    "reason": "CODEC",
    "message": "unregister Content-Type: multipart/form-data; boundary=--------------------------187292697950545999179746",
    "metadata": {}
}

as discussed before,#2198
it is not nessary to define mutipart/form-data in proto,we can define a service as normal,and make a function to overwrite the method in splitted go file ,so that the kratos generated code and be reused and the api can also be included in the openapi file.

@czyt czyt added the feature label Aug 5, 2022
@shenqidebaozi
Copy link
Member

shenqidebaozi commented Aug 7, 2022

The HTTP interface defined by proto does not support uploading files
https://github.com/go-kratos/examples/tree/main/http/upload

@czyt czyt closed this as completed Aug 11, 2022
@MouseSun846
Copy link

对于当前版本的 Kratos 显示错误

{
    "code": 400,
    "reason": "CODEC",
    "message": "unregister Content-Type: multipart/form-data; boundary=--------------------------187292697950545999179746",
    "metadata": {}
}

如前所述,#2198 在 Proto 中定义是不合适的,我们可以像往常一样定义一个服务,并在拆分后的 Go 文件中做一个函数来覆盖方法,这样 Kratos 生成的代码就可以被复用,API 也可以包含在 OpenAPI 文件中。mutipart/form-data

你好,我想问下,你最后是怎么解决的?

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

No branches or pull requests

3 participants