Skip to content

Commit

Permalink
fix(docs): adjust the HTTP Client example to work (#1026)
Browse files Browse the repository at this point in the history
  • Loading branch information
co-go authored Sep 23, 2024
1 parent a98ec31 commit 4560d18
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions example_versioned_docs/version-latest/33-http-client.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ bring http;
bring cloud;

struct Pokemon {
id: str;
id: num;
name: str;
order: num;
weight: num;
Expand All @@ -29,18 +29,17 @@ new cloud.Function(inflight () => {
// response status
log(x.status);

// Cast response back into struct
let ditto = Pokemon.fromJson(x.body);
log(ditto.name);
// parse string response as a JSON object
let data = Json.parse(x.body);

// cast JSON response into struct
let ditto = Pokemon.fromJson(data);
log(ditto.name);
});
```

```bash title="Wing console output"
# Run locally with wing console
No directory found
200
ditto
```




0 comments on commit 4560d18

Please sign in to comment.