Skip to content
This repository was archived by the owner on Aug 2, 2022. It is now read-only.
This repository was archived by the owner on Aug 2, 2022. It is now read-only.

Passing an endpoint to JsonRpc with trailing / results in Error: Unknown Endpoint #558

@poplexity

Description

@poplexity

Version of EOSJS
20.0.0-beta3

Describe the bug
A trailing / on the endpoint url will cause eosjs to fail with error Error: Unknown Endpoint

To Reproduce
npm install eosjs@beta node-fetch
then run

const JsonRpc = require('eosjs').JsonRpc
const fetch = require('node-fetch')

const eos = new JsonRpc('http://testnet.telosusa.io/', { fetch })
eos.get_table_rows({json:true, scope: 'priveosrules', code: 'priveosrules',  table: 'nodes', limit:100}).then((data) => {
  console.log(data)
});

Then remove the trailing / on the endpoint and try again.

Expected behavior
The trailing / could be checked for and handled for the developer, or at least a more friendly error message

Desktop (please complete the following information):

  • OS: OSX
  • Node: v10.15.1
  • Browser n/a
  • Version n/a

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions