Skip to content
New issue

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

axios.get("file://path/to/file") fails with AssertionError actual: 'file:', expected: 'http:' #5648

Open
pmorch opened this issue Apr 12, 2023 · 2 comments · May be fixed by #6317
Open

axios.get("file://path/to/file") fails with AssertionError actual: 'file:', expected: 'http:' #5648

pmorch opened this issue Apr 12, 2023 · 2 comments · May be fixed by #6317
Labels
type::bug Used when reporting a bug

Comments

@pmorch
Copy link

pmorch commented Apr 12, 2023

Describe the bug

I was expecting to be able to use axios to get files also using the file://... scheme. But it doesn't work.

I don't think this is the same as #2416 (or #2558), since this fails pretty hard.

To Reproduce

$ echo 'require("axios").get("file://path/to/file")' | node
            triggerUncaughtException(err, true /* fromPromise */);
            ^

AssertionError [ERR_ASSERTION]: protocol mismatch
    at Object.request (/home/pmorch/work/try/my-extension/node_modules/follow-redirects/index.js:521:14)
    at dispatchHttpRequest (/home/pmorch/work/try/my-extension/node_modules/axios/dist/node/axios.cjs:2816:21)
    at /home/pmorch/work/try/my-extension/node_modules/axios/dist/node/axios.cjs:2538:5
    at new Promise (<anonymous>)
    at wrapAsync (/home/pmorch/work/try/my-extension/node_modules/axios/dist/node/axios.cjs:2518:10)
    at http (/home/pmorch/work/try/my-extension/node_modules/axios/dist/node/axios.cjs:2544:10)
    at Axios.dispatchRequest (/home/pmorch/work/try/my-extension/node_modules/axios/dist/node/axios.cjs:3487:10)
    at Axios.request (/home/pmorch/work/try/my-extension/node_modules/axios/dist/node/axios.cjs:3843:33)
    at Axios.<computed> [as get] (/home/pmorch/work/try/my-extension/node_modules/axios/dist/node/axios.cjs:3869:17)
    at Function.wrap [as get] (/home/pmorch/work/try/my-extension/node_modules/axios/dist/node/axios.cjs:29:15) {
  generatedMessage: false,
  code: 'ERR_ASSERTION',
  actual: 'file:',
  expected: 'http:',
  operator: '=='
}

Node.js v18.12.1

Code snippet

See above

Expected behavior

I expect to be able to get files too

Axios Version

1.3.5

Adapter Version

I don't know

Browser

node.js

Browser Version

No response

Node.js Version

v18.12.1

OS

Linux

Additional Library Versions

No response

Additional context/Screenshots

No response

@mskarimi
Copy link

same issue

@DavidJDallas DavidJDallas added the type::bug Used when reporting a bug label Sep 4, 2023
@All3xJ
Copy link

All3xJ commented Mar 23, 2024

me too

skwigel added a commit to skwigel/axios that referenced this issue Mar 24, 2024
@skwigel skwigel linked a pull request Mar 24, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type::bug Used when reporting a bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants