This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Example data set to URLRequest httpBody | |
// { | |
// "query": "query HeroNameAndFriends($episode: Episode) { hero(episode: $episode) { name friends { name } } }", | |
// "operationName": "", | |
// "variables": { "episode": "JEDI" } | |
// } | |
struct Payload: Decodable { | |
let query: String | |
} | |
let outputData = try Data(inputStream: httpBodyStream) | |
let payload = try JSONDecoder().decode(Payload.self, from: outputData) | |
print(payload.query) | |
// Prints: query HeroNameAndFriends($episode: Episode) { hero(episode: $episode) { name friends { name } } } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment