Skip to content
Discussion options

You must be logged in to vote

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:

  • Many environments do not allow you to override the referrer (e.g. browsers)
  • Use the user/password properties instead of setting a basic auth manually
  • Use the allowGzip option to automatically set the Accept-Encoding and decompress the result

Using the built-in properties help ensure portability between node and browsers.

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by du5
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #2994 on May 26, 2022 03:08.