From cb3533a74e76ff8edabe20427bc5798b387992e2 Mon Sep 17 00:00:00 2001 From: Abhishek Chauhan Date: Fri, 2 Sep 2022 16:00:04 +0200 Subject: [PATCH] docs: Update README.md (#4192) Added infura header --- packages/ipfs-http-client/README.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/packages/ipfs-http-client/README.md b/packages/ipfs-http-client/README.md index 666171ca70..0b4d457a45 100644 --- a/packages/ipfs-http-client/README.md +++ b/packages/ipfs-http-client/README.md @@ -33,6 +33,7 @@ - [Importing the module and usage](#importing-the-module-and-usage) - [In a web browser](#in-a-web-browser) - [Custom Headers](#custom-headers) + - [Infura Header](#Infura-header) - [Global Timeouts](#global-timeouts) - [Development](#development) - [Testing](#testing) @@ -350,6 +351,23 @@ const ipfs = create({ }) ``` +### Infura Header + +If you wish to send infura headers with each request made by this library, for example, the Authorization header. You can use the config to do so: + +```js +const auth = + 'Basic ' + Buffer.from(INFURA_ID + ':' + INFURA_SECRET_KEY).toString('base64'); +const client = ipfsClient.create({ + host: 'ipfs.infura.io', + port: 5001, + protocol: 'https', + headers: { + authorization: auth, + }, +}); +``` + ### Global Timeouts To set a global timeout for *all* requests pass a value for the `timeout` option: