在 Hotchocolate Graphql 中,无法使用香蕉蛋糕弹出窗口上传文件,出现服务器错误

1 c# graphql asp.net-core hotchocolate

热巧克力文件上传错误

我正在使用 Hotchocolate nuget 包来使用 Banana Cake Pop 来实现 GraphQL。我已经使用 UploadType 实现了文件上传。

builder.Services
                    .AddGraphQLServer()
                    .AddQueryType<Query>()
                    .AddMutationType<Mutation>()
                    .AddType<UploadType>()
                    .AddTypeExtension<AuthorExtensions>()
                    .AddMutationConventions();
Run Code Online (Sandbox Code Playgroud)

突变请求:

mutation ($input:UploadProfilePictureInput!){
  uploadProfilePicture(input: $input){
    author{
      id
    }
  }
}

{
  "input": {"file": "ts.json", "authorId": 1}
}

Run Code Online (Sandbox Code Playgroud)

回复:

{
  "message": "",
  "name": "ServerError",
  "statusCode": 404,
  "statusText": "",
  "bodyText": ""
}
Run Code Online (Sandbox Code Playgroud)

我在邮递员中尝试了与表单数据相同的操作。但我遇到了同样的错误。除了上传文件之外的其他查询我可以在邮递员中获得输出。请帮助我我哪里出错了!

Mic*_*aib 9

如果您使用的是最新版本的 Hot Chocolate,我们已为文件上传添加了一些安全性,并且默认情况下需要预检标头。

GraphQL-preflight:1

https://github.com/ChilliCream/graphql-platform/issues/6188

在最新的 Banana Cake Pop 版本中,我们已将标题添加到下拉列表中的通用标题中。

在此输入图像描述