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

Stubs for certain request methods? #87

Open
sezanzeb opened this issue Apr 13, 2021 · 6 comments
Open

Stubs for certain request methods? #87

sezanzeb opened this issue Apr 13, 2021 · 6 comments

Comments

@sezanzeb
Copy link

I want to add different stubs for GET and POST methods on the same URL.

@qs-labs
Copy link

qs-labs commented Apr 21, 2021

@sezanzeb I myself haven't gotten stubs to work but checkout the declaration for stubRequest, it supports an optional first parameter allowing you to specify the type of axios request.

@marcopeg
Copy link

By passing the method as first argument, the request will hang forever :-(

@nzwsch
Copy link

nzwsch commented Oct 17, 2021

This should work.

moxios.stubRequest('/say/hello', {
  method: 'POST',
  status: 200,
  responseText: 'hello',
})

@lior-chervinsky
Copy link

Looks like the /dist folder isn't updated with the latest source code.

Code in dist folder:

image

Code in index.js:

image

@filidorwiese
Copy link

filidorwiese commented Feb 6, 2023

☝️ Could one of the developers please update the dist and publish a new package to npm? Thanks that would be wonderful!

@willnguyen1312
Copy link

#106 should fix this. I'm not so sure who is in charge as of now since the package is untouched for a while already 😅

As a work around, you could absolutely clone the repo, build it and push to Github or whatever repository you can have access to and install via the trick below.
https://stackoverflow.com/questions/39732397/install-specific-branch-from-github-using-npm

In my case, I created one at https://github.com/willnguyen1312/moxios/tree/main and install like so:
pnpm add willnguyen1312/moxios#main

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants