Apollo-graphql 客户端拒绝 Base64 字符串数据
Appolo-graphql client reject Base64 string data
我已经使用 apollo-server 创建了一个 graphql 端点。但我不能在有效负载中包含 base64 图像字符串。它导致 JSON 错误
mutation {
createMyData(input:
{
firstName:"test"
lastName:"test123",
userImage : "data:image/jpeg;base64,/9j/4AAQSkZJRgABWSgIaFFiAIFEkAf//Z" (sample base64 string)
})
{
firstName
}
}
我在操场上遇到这样的错误
{
"error": "Unexpected token < in JSON at position 0"
}
PayloadTooLargeError: request entity too large
我们可以轻松自定义 JSON 数据包大小。
app.use(bodyParser.json({limit: '5mb'}));
我已经使用 apollo-server 创建了一个 graphql 端点。但我不能在有效负载中包含 base64 图像字符串。它导致 JSON 错误
mutation {
createMyData(input:
{
firstName:"test"
lastName:"test123",
userImage : "data:image/jpeg;base64,/9j/4AAQSkZJRgABWSgIaFFiAIFEkAf//Z" (sample base64 string)
})
{
firstName
}
}
我在操场上遇到这样的错误
{
"error": "Unexpected token < in JSON at position 0"
}
PayloadTooLargeError: request entity too large
我们可以轻松自定义 JSON 数据包大小。
app.use(bodyParser.json({limit: '5mb'}));