Skip to content

Commit

Permalink
chore(docs): fix http get example
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonkuhrt committed Oct 1, 2024
1 parent ade5a3e commit 4fd8829
Show file tree
Hide file tree
Showing 17 changed files with 342 additions and 252 deletions.
6 changes: 4 additions & 2 deletions examples/10_transport-http/transport-http_method-get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ const graffle = Pokemon

// The following request will use an HTTP POST method because it is
// using a "mutation" type of operation.
await graffle.rawString({ document: `mutation { addPokemon(attack:0, defense:0, hp:1, name:"Nano") { name } }` })
await graffle.rawString({
document: `mutation { addPokemon(attack:0, defense:0, hp:1, name:"Nano", type: grass) { name } }`,
})

// The following request will use an HTTP GET method because it
// is using a "query" type of operation.
await graffle.rawString({ document: `query { pokemonByName(name:"Nano") { hp } }` })
await graffle.rawString({ document: `query { pokemonByName(name: "Nano") { hp } }` })
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
headers: Headers {
accept: 'application/graphql-response+json; charset=utf-8, application/json; charset=utf-8',
'content-type': 'application/json',
'x-sent-at-time': '1727568837251'
'x-sent-at-time': '1727803644880'
},
signal: undefined,
method: 'post',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,31 +1,50 @@
/some/path/to/handleOutput.ts:XX:XX
const error = new Errors.ContextualAggregateError(
^


ContextualAggregateError: One or more errors in the execution result.
at handleOutput (/some/path/to/handleOutput.ts:XX:XX:19)
at run (/some/path/to/client.ts:XX:XX:12)
at process.processTicksAndRejections (node:internal/process/task_queues:XX:XX)
at async runRaw (/some/path/to/client.ts:XX:XX:12)
at async Object.raw (/some/path/to/client.ts:XX:XX:14)
at async Proxy.rawString (/some/path/to/client.ts:XX:XX:14)
at async <anonymous> (/some/path/to/transport-http_method-get.ts:XX:XX:1) {
context: {},
cause: undefined,
errors: [
GraphQLError: Field "addPokemon" argument "type" of type "PokemonType!" is required, but it was not provided.
at <anonymous> (/some/path/to/graphqlHTTP.ts:XX:XX:47)
at Array.map (<anonymous>)
at parseExecutionResult (/some/path/to/graphqlHTTP.ts:XX:XX:28)
at Object.unpack (/some/path/to/core.ts:XX:XX:26)
at process.processTicksAndRejections (node:internal/process/task_queues:XX:XX)
at async runHook (/some/path/to/runHook.ts:XX:XX:16) {
path: undefined,
locations: undefined,
extensions: [Object: null prototype] {}
}
]
---------------------------------------- SHOW ----------------------------------------
{
methodMode: 'getReads',
headers: Headers {
accept: 'application/graphql-response+json; charset=utf-8, application/json; charset=utf-8',
'content-type': 'application/json',
tenant: 'nano'
},
signal: undefined,
method: 'post',
url: URL {
href: 'http://localhost:3000/graphql',
origin: 'http://localhost:3000',
protocol: 'http:',
username: '',
password: '',
host: 'localhost:3000',
hostname: 'localhost',
port: '3000',
pathname: '/graphql',
search: '',
searchParams: URLSearchParams {},
hash: ''
},
body: '{"query":"mutation { addPokemon(attack:0, defense:0, hp:1, name:\\"Nano\\", type: grass) { name } }"}'
}

Node.js vXX.XX.XX
---------------------------------------- SHOW ----------------------------------------
{
methodMode: 'getReads',
headers: Headers {
accept: 'application/graphql-response+json; charset=utf-8, application/json; charset=utf-8',
tenant: 'nano'
},
signal: undefined,
method: 'get',
url: URL {
href: 'http://localhost:3000/graphql?query=query+%7B+pokemonByName%28name%3A+%22Nano%22%29+%7B+hp+%7D+%7D',
origin: 'http://localhost:3000',
protocol: 'http:',
username: '',
password: '',
host: 'localhost:3000',
hostname: 'localhost',
port: '3000',
pathname: '/graphql',
search: '?query=query+%7B+pokemonByName%28name%3A+%22Nano%22%29+%7B+hp+%7D+%7D',
searchParams: URLSearchParams { 'query' => 'query { pokemonByName(name: "Nano") { hp } }' },
hash: ''
}
}
2 changes: 1 addition & 1 deletion examples/__outputs__/20_output/output_envelope.output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
headers: Headers {
'content-type': 'application/graphql-response+json; charset=utf-8',
'content-length': '142',
date: 'Sun, 29 Sep 2024 00:13:57 GMT',
date: 'Tue, 01 Oct 2024 17:27:25 GMT',
connection: 'keep-alive',
'keep-alive': 'timeout=5'
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
}
},
instrumentationScope: { name: 'graffle', version: undefined, schemaUrl: undefined },
traceId: '4bdd8c57b66a6f52c0a4007ab958299f',
parentId: '34963c7854e3930d',
traceId: 'd7f120898ea4e086c016a9328aeb4588',
parentId: '8977b7ec1a73aa42',
traceState: undefined,
name: 'encode',
id: 'e4dabd3af63b2f57',
id: '5c86f62c08b7f3bd',
kind: 0,
timestamp: 1727568838243000,
duration: 550.75,
timestamp: 1727803645728000,
duration: 748.709,
attributes: {},
status: { code: 0 },
events: [],
Expand All @@ -33,14 +33,14 @@
}
},
instrumentationScope: { name: 'graffle', version: undefined, schemaUrl: undefined },
traceId: '4bdd8c57b66a6f52c0a4007ab958299f',
parentId: '34963c7854e3930d',
traceId: 'd7f120898ea4e086c016a9328aeb4588',
parentId: '8977b7ec1a73aa42',
traceState: undefined,
name: 'pack',
id: 'fabd8bd0776b28f7',
id: 'ac44e7f088223e59',
kind: 0,
timestamp: 1727568838246000,
duration: 11052.666,
timestamp: 1727803645732000,
duration: 12910.625,
attributes: {},
status: { code: 0 },
events: [],
Expand All @@ -57,14 +57,14 @@
}
},
instrumentationScope: { name: 'graffle', version: undefined, schemaUrl: undefined },
traceId: '4bdd8c57b66a6f52c0a4007ab958299f',
parentId: '34963c7854e3930d',
traceId: 'd7f120898ea4e086c016a9328aeb4588',
parentId: '8977b7ec1a73aa42',
traceState: undefined,
name: 'exchange',
id: 'adb9ae40a9efa2e6',
id: '07c6d24729766b4d',
kind: 0,
timestamp: 1727568838257000,
duration: 24543.375,
timestamp: 1727803645745000,
duration: 21332.375,
attributes: {},
status: { code: 0 },
events: [],
Expand All @@ -81,14 +81,14 @@
}
},
instrumentationScope: { name: 'graffle', version: undefined, schemaUrl: undefined },
traceId: '4bdd8c57b66a6f52c0a4007ab958299f',
parentId: '34963c7854e3930d',
traceId: 'd7f120898ea4e086c016a9328aeb4588',
parentId: '8977b7ec1a73aa42',
traceState: undefined,
name: 'unpack',
id: 'c3f2918fad31578e',
id: '14366c75d72eb1d4',
kind: 0,
timestamp: 1727568838282000,
duration: 1198.584,
timestamp: 1727803645767000,
duration: 1140.625,
attributes: {},
status: { code: 0 },
events: [],
Expand All @@ -105,14 +105,14 @@
}
},
instrumentationScope: { name: 'graffle', version: undefined, schemaUrl: undefined },
traceId: '4bdd8c57b66a6f52c0a4007ab958299f',
parentId: '34963c7854e3930d',
traceId: 'd7f120898ea4e086c016a9328aeb4588',
parentId: '8977b7ec1a73aa42',
traceState: undefined,
name: 'decode',
id: 'bf9bc7a293f29302',
id: 'e89206579d516345',
kind: 0,
timestamp: 1727568838284000,
duration: 192.583,
timestamp: 1727803645768000,
duration: 192.958,
attributes: {},
status: { code: 0 },
events: [],
Expand All @@ -129,14 +129,14 @@
}
},
instrumentationScope: { name: 'graffle', version: undefined, schemaUrl: undefined },
traceId: '4bdd8c57b66a6f52c0a4007ab958299f',
traceId: 'd7f120898ea4e086c016a9328aeb4588',
parentId: undefined,
traceState: undefined,
name: 'request',
id: '34963c7854e3930d',
id: '8977b7ec1a73aa42',
kind: 0,
timestamp: 1727568838243000,
duration: 41029.083,
timestamp: 1727803645728000,
duration: 40803.792,
attributes: {},
status: { code: 0 },
events: [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@ console.log(data)
}
},
instrumentationScope: { name: 'graffle', version: undefined, schemaUrl: undefined },
traceId: '4bdd8c57b66a6f52c0a4007ab958299f',
parentId: '34963c7854e3930d',
traceId: 'd7f120898ea4e086c016a9328aeb4588',
parentId: '8977b7ec1a73aa42',
traceState: undefined,
name: 'encode',
id: 'e4dabd3af63b2f57',
id: '5c86f62c08b7f3bd',
kind: 0,
timestamp: 1727568838243000,
duration: 550.75,
timestamp: 1727803645728000,
duration: 748.709,
attributes: {},
status: { code: 0 },
events: [],
Expand All @@ -64,14 +64,14 @@ console.log(data)
}
},
instrumentationScope: { name: 'graffle', version: undefined, schemaUrl: undefined },
traceId: '4bdd8c57b66a6f52c0a4007ab958299f',
parentId: '34963c7854e3930d',
traceId: 'd7f120898ea4e086c016a9328aeb4588',
parentId: '8977b7ec1a73aa42',
traceState: undefined,
name: 'pack',
id: 'fabd8bd0776b28f7',
id: 'ac44e7f088223e59',
kind: 0,
timestamp: 1727568838246000,
duration: 11052.666,
timestamp: 1727803645732000,
duration: 12910.625,
attributes: {},
status: { code: 0 },
events: [],
Expand All @@ -91,14 +91,14 @@ console.log(data)
}
},
instrumentationScope: { name: 'graffle', version: undefined, schemaUrl: undefined },
traceId: '4bdd8c57b66a6f52c0a4007ab958299f',
parentId: '34963c7854e3930d',
traceId: 'd7f120898ea4e086c016a9328aeb4588',
parentId: '8977b7ec1a73aa42',
traceState: undefined,
name: 'exchange',
id: 'adb9ae40a9efa2e6',
id: '07c6d24729766b4d',
kind: 0,
timestamp: 1727568838257000,
duration: 24543.375,
timestamp: 1727803645745000,
duration: 21332.375,
attributes: {},
status: { code: 0 },
events: [],
Expand All @@ -118,14 +118,14 @@ console.log(data)
}
},
instrumentationScope: { name: 'graffle', version: undefined, schemaUrl: undefined },
traceId: '4bdd8c57b66a6f52c0a4007ab958299f',
parentId: '34963c7854e3930d',
traceId: 'd7f120898ea4e086c016a9328aeb4588',
parentId: '8977b7ec1a73aa42',
traceState: undefined,
name: 'unpack',
id: 'c3f2918fad31578e',
id: '14366c75d72eb1d4',
kind: 0,
timestamp: 1727568838282000,
duration: 1198.584,
timestamp: 1727803645767000,
duration: 1140.625,
attributes: {},
status: { code: 0 },
events: [],
Expand All @@ -145,14 +145,14 @@ console.log(data)
}
},
instrumentationScope: { name: 'graffle', version: undefined, schemaUrl: undefined },
traceId: '4bdd8c57b66a6f52c0a4007ab958299f',
parentId: '34963c7854e3930d',
traceId: 'd7f120898ea4e086c016a9328aeb4588',
parentId: '8977b7ec1a73aa42',
traceState: undefined,
name: 'decode',
id: 'bf9bc7a293f29302',
id: 'e89206579d516345',
kind: 0,
timestamp: 1727568838284000,
duration: 192.583,
timestamp: 1727803645768000,
duration: 192.958,
attributes: {},
status: { code: 0 },
events: [],
Expand All @@ -172,14 +172,14 @@ console.log(data)
}
},
instrumentationScope: { name: 'graffle', version: undefined, schemaUrl: undefined },
traceId: '4bdd8c57b66a6f52c0a4007ab958299f',
traceId: 'd7f120898ea4e086c016a9328aeb4588',
parentId: undefined,
traceState: undefined,
name: 'request',
id: '34963c7854e3930d',
id: '8977b7ec1a73aa42',
kind: 0,
timestamp: 1727568838243000,
duration: 41029.083,
timestamp: 1727803645728000,
duration: 40803.792,
attributes: {},
status: { code: 0 },
events: [],
Expand Down
Loading

0 comments on commit 4fd8829

Please sign in to comment.