kratos icon indicating copy to clipboard operation
kratos copied to clipboard

[Feature] multipart/form-data encoding

Open czyt opened this issue 1 year ago • 1 comments

for current version kratos display error

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

as discussed before,https://github.com/go-kratos/kratos/issues/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 avatar Aug 05 '22 03:08 czyt

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

shenqidebaozi avatar Aug 07 '22 02:08 shenqidebaozi

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

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

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

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

MouseSun846 avatar Dec 07 '23 14:12 MouseSun846