Skip to content

Commit ea27fc1

Browse files
committed
Fix example to parse JSON response and check success field
1 parent 5f3d9f9 commit ea27fc1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ const response = await fetch('http://localhost:3000/send-to-all-clients?encoding
4646
body: '>4\r\n$6\r\nMOVING\r\n:1\r\n:2\r\n$6\r\nhost:3\r\n'
4747
});
4848

49-
const result = await response.text();
50-
console.log(result.includes('"success":true') ? 'Injected' : 'Failed');
49+
const result = await response.json();
50+
console.log(result.success ? 'Injected' : 'Failed');
5151
```
5252

5353
**Go Example:**

0 commit comments

Comments
 (0)