Skip to content

Commit 0a1f6c1

Browse files
authored
Update README.md
1 parent 0caa6f9 commit 0a1f6c1

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

README.md

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,12 +350,35 @@ Assert.AreEqual(charactersResultsByName, charactersResultsByIndex);
350350

351351
var countResult = batchResults.GetConnectionResults<StarWarsCharacter>("charactersCount");
352352
Assert.IsTrue(countResult.TotalCount > charactersResultsByName.Count);
353+
```
354+
355+
### RAW Json Handling (fully manual)
356+
You can always request the raw Json response that was returned by the GraphQL server ready to be fully handled manually (for off-the-wall edge cases).
357+
Simply use the `.ReceiveGraphQLRawJsonResponse()` api method to get the response as a parsed Json result (e.g. `JObject` for `Newtonsoft.Json`)
353358

359+
```csharp
360+
var json = await "https://graphql-star-wars.azurewebsites.net/api/graphql"
361+
.WithGraphQLQuery(@"
362+
query ($first: Int) {
363+
characters(first: $first) {
364+
nodes {
365+
personalIdentifier
366+
name
367+
height
368+
}
369+
}
370+
}
371+
")
372+
.SetGraphQLVariables(new { first = 2 })
373+
.PostGraphQLQueryAsync()
374+
.ReceiveGraphQLRawJsonResponse()
375+
.ConfigureAwait(false);
354376
```
355377

378+
356379
### Error Handling
357380
Consistent with the [spirit of Flurl for error handling](https://flurl.dev/docs/error-handling/#error-handling), errors from GraphQL will result
358-
in a FlurlGraphQLException being thrown with the details of the errors payload already provided as a helpful error message. However the raw error
381+
in a `FlurlGraphQLException` being thrown with the details of the errors payload already parsed & provided as a helpful error message. However the raw error
359382
details are also available in the `GraphQLErrors` property.
360383

361384
```csharp

0 commit comments

Comments
 (0)