【发布时间】:2018-02-27 07:43:33
【问题描述】:
我一直在阅读和尝试很多东西,但只使用 cURL 作为工具。是否有其他方法针对 GraphQL 端点运行测试?
所以我的问题是带有多个变量的突变查询。这是我的 Shema 的一部分:
type mutation {
oneComponentTypeCollected(userID: String!, password: String!, pageID: Int!,
Components: ComponentsInput!): Page
}
type Components {
ComponentType: ComponentType!
required: Int!
collected: Int!
}
type ComponentsInput {
id: String!
collected: Int!
}
type Page {
id: Int!
}
我如何调用查询 oneComponentCollected 突变? 预期将收集的值设置为组件“inkpad_blue”的 1
我尝试了以下方法:
变量语法:
{"query":"mutation($input:ComponentsInput!) {oneComponentTypeCollected(userID: \"asd\", password: \"asd\", pageID: 1, input:$input){id}}","variables":{"input":{"id":"Inkpad_blue","collected":1}}}
作为纯字符串:
mutation($input:ComponentsInput!) {oneComponentTypeCollected(userID: "asd", password: "asd", pageID: 1, input:$input){id}}
两者都会导致 500 个 HTTP 错误。
【问题讨论】:
标签: javascript graphql graphql-js