Skip to content

registerEndpoint does not work for axios #1261

Open
@lud-hu

Description

@lud-hu

Environment


  • Operating System: Linux
  • Node Version: v20.19.0
  • Nuxt Version: 3.16.2
  • CLI Version: 3.25.0
  • Nitro Version: 2.11.9
  • Package Manager: [email protected]
  • Builder: -
  • User Config: compatibilityDate, devtools
  • Runtime Modules: -
  • Build Modules: -

Reproduction

https://stackblitz.com/edit/github-jjtvfths?file=test%2Ftest.nuxt.spec.ts

Describe the bug

The registerEndpoint function does work properly for $fetch but not for axios. Shouldn't it just mock all requests going to the specified URL no matter where the request comes from?

Additional context

No response

Logs

 ❯ test/test.nuxt.spec.ts (2 tests | 1 failed) 16ms
   × tests > an axios request 14ms
     → Network Error
   ✓ tests > a $fetch request 1ms

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions