w7a9q
Explore posts from serversGet body of the response
Yeah but you can use middleware to manipulate with the response as well, right? I don't have any code. I want to write a middleware and read the body of the response I return back from endpoint implemented in the
server/api
.13 replies
Mocking useStorage
Looks like Nitro is not accessible outside of server: https://github.com/nuxt/nuxt/issues/23484#issuecomment-1742010287
4 replies
Mocking useStorage
I have tried adding
@vueuse/core
package and then importing the function from it: import { useStorage } from '@vueuse/core'
. It did not solve the problem. Here is the StackBlitz repl: https://stackblitz.com/edit/nuxt-starter-bf2fpu?file=test%2Futils.test.ts4 replies
Mocking useStorage
I tried this solution: https://stackoverflow.com/questions/74993530/how-to-test-a-function-that-uses-nitros-usestorage
Now the error is thrown from the actual function:
ReferenceError: useStorage is not defined
- that should beeen autoimported as well. In the post he changes the actual implementation to use mock, I don't want this.
What is the best practice about this?4 replies