You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+30Lines changed: 30 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -736,6 +736,36 @@ for (const audit of serverAudits({
736
736
737
737
</details>
738
738
739
+
<detailsid="audit-deno">
740
+
<summary><ahref="#audit-deno">🔗</a> Audit for servers usage in <ahref="https://deno.land">Deno</a> environment</summary>
741
+
742
+
```ts
743
+
import { serverAudits } from'npm:graphql-http';
744
+
745
+
for (const audit ofserverAudits({
746
+
url: 'http://localhost:4000/graphql',
747
+
fetchFn: fetch,
748
+
})) {
749
+
Deno.test(audit.name, async () => {
750
+
const result =awaitaudit.fn();
751
+
if (result.status==='error') {
752
+
throwresult.reason;
753
+
}
754
+
if (result.status==='warn') {
755
+
console.warn(result.reason); // or throw if you want full compliance (warnings are not requirements)
756
+
}
757
+
// Avoid leaking resources
758
+
if ('body'inresult&&result.bodyinstanceofReadableStream) {
759
+
awaitresult.body.cancel();
760
+
}
761
+
});
762
+
}
763
+
```
764
+
765
+
Put the above contents in a file and run it with `deno test --allow-net`.
766
+
767
+
</details>
768
+
739
769
## Only [GraphQL over HTTP](https://graphql.github.io/graphql-over-http/)
740
770
741
771
This is the official [GraphQL over HTTP spec](https://graphql.github.io/graphql-over-http/) reference implementation and as such follows the specification strictly without any additional features (like file uploads, @stream/@defer directives and subscriptions).
0 commit comments