-
Describe the FeatureSupport setting http headers Code Exampleconst eth = new ethers.providers.JsonRpcProvider(Rpc)
eth.connection.headers = {
'Content-Type': 'application/json; charset=utf-8',
'Accept': 'application/json',
'Accept-Encoding': 'gzip, deflate, br',
'Accept-Language': 'en-US,en;q=0.9,zh-CN;q=0.8,zh;q=0.7',
'referer': 'https://xxxxx.com/,
} |
Beta Was this translation helpful? Give feedback.
Answered by
ricmoo
May 26, 2022
Replies: 2 comments
-
This is already You can pass a ConnectionInfo into the JsonRpcProvider. For example: const connection = {
headers: [ "Content-Type": "application/json; charset=utf-8"
};
const provider = new JsonRpcProvider(connection); A few things to keep in mind:
Using the built-in properties help ensure portability between node and browsers. |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
du5
-
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is already You can pass a ConnectionInfo into the JsonRpcProvider.
For example:
A few things to keep in mind:
user
/password
properties instead of setting a basic auth manuallyallowGzip
option to automatically set theAccept-Encoding
and decompress the resultUsing the built-in properties help ensure portability between node and browsers.