Skip to content

Commit

Permalink
docs(readme): Clarification
Browse files Browse the repository at this point in the history
  • Loading branch information
grantila committed Nov 28, 2018
1 parent b263724 commit c4d2ce4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,16 @@ Create a new context where `'br'` should be supported:
import { context } from 'fetch-h2'
import brDecode from 'fetch-h2-br'

// Setup only once to avoid undefined behavior
// Create a context where 'br' is supported
const { fetch } = context( { decoders: [ brDecode( ) ] } );

// Now, all subsequent fetch-calls with this particular fetch will support the 'br' encoding:
const response = await fetch( 'https://host/file' );

// Yet another context
const { fetch: fetchOther } = context( );
// fetchOther will *not* support 'br'
// fetchOther will *not* support 'br':
const response2 = await fetchOther( 'https://host/file' );
```

[npm-image]: https://img.shields.io/npm/v/fetch-h2-br.svg
Expand Down

0 comments on commit c4d2ce4

Please sign in to comment.