我在使用graphQL的Phoenix上运行了app-A。 我有以下查询:
{
decks(date: "2019-01-05") {
id
title
description
}
}
查询具有String类型的必需参数date。格式为“ YYYY-MM-DD” 从app-A上的graphQl接口运行查询可以正确返回数据。
现在,我尝试从javascript文件的app-B调用相同的查询。
const deckQuery = `{
decks(date: "2019-01-05") {
id
title
description
}
}`;
在将其传递给APP-A之前,查询将解析为以下语法:
"{ \"query\": \"query \n {\n decks(date: \"2019-01-05\") {\n id\n title\n description\n }\n }\n\" }"
但是我得到以下响应:
Encoding::CompatibilityError (incompatible character encodings: UTF-8 and ASCII-8BIT)
我认为问题出在解析数据格式。由于我所有其他不包含属性的查询,因此请按预期返回数据。
有关如何解决此问题的任何想法和建议?