We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Currently, only URLs that end with .json are handled as json. However, there are also URLs, that do not end with .json but still have json content. Here an example: https://nftstorage.link/ipfs/bafkreic5xs3jg3m4poqqikwyslatiyknkevtwyqqzlouokwlslgkiu5nga
.json
Extend the current check by checking whether the content is of json format by parsing the the response data via JSON.parse.
JSON.parse
Dummy code:
async function isJson(url: string): Promise<boolean> { try { const response = ... // Try to parse the content as JSON try { JSON.parse(response.data); return true; } catch (error) { return false; } } }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Currently, only URLs that end with
.json
are handled as json. However, there are also URLs, that do not end with.json
but still have json content. Here an example: https://nftstorage.link/ipfs/bafkreic5xs3jg3m4poqqikwyslatiyknkevtwyqqzlouokwlslgkiu5ngaExtend the current check by checking whether the content is of json format by parsing the the response data via
JSON.parse
.Dummy code:
The text was updated successfully, but these errors were encountered: