graphql - 在 Graphql 请求中发送双引号和反斜杠

标签 graphql graphql-js

我想在 Graphql 请求中发送双引号(")和反斜杠(\),并希望将其取回作为响应。

请检查以下示例:

mutation M { 
    signUp
    (
        name: "Harsha Vardhan"
        username: "Harsha143", 
        email: "harshavardhan@sample.com",
        description: "Cool "boy" \n And good looking."
    ) 
    {
        _id,
        name
        username,
        email,
        description
}

在上面的 Mutation 中,我想在描述中发送双引号和反斜杠。请指导我克服这个问题。

提前致谢。

最佳答案

你应该尝试像这样转义这些字符

mutation M { 
    signUp
    (
        name: "Harsha Vardhan"
        username: "Harsha143", 
        email: "harshavardhan@sample.com",
        description: "Cool \"boy\" \\n And good looking."
    ) 
    {
        _id,
        name
        username,
        email,
        description
}

希望有帮助!

关于graphql - 在 Graphql 请求中发送双引号和反斜杠,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37709250/

相关文章:

Python GraphQL API 调用组合

asp.net-core - HotChocolate GraphQL 在运行时添加类型扩展或模式

javascript - IE-graphql-SCRIPT5022 : Cannot use undefined "Boolean" from another module or realm

json - GraphQL : fulfill query from JSON file source

graphql - Apollo Graphql 导入问题与cacheControl指令

javascript - 使用 buildSchema 时如何访问字段解析器内父解析器的值?

rest - 嵌套资源上的 GraphQL 突变

go - 获取变量\"$address\"不能是非输入类型\"String!\in go-graphql

graphql - 在 graphQL 中提交一个对象数组作为查询变量

javascript - GraphQL 流类型?