Skip to content
This repository has been archived by the owner on Dec 19, 2023. It is now read-only.

Commit

Permalink
docs: add info about registerEndpoint with method (#395)
Browse files Browse the repository at this point in the history
  • Loading branch information
yassilah authored Nov 20, 2023
1 parent 6c26a98 commit ac2a1f8
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,17 @@ registerEndpoint("/test/", () => ({
}))
```
By default, your request will be made using the `GET` method. You may use another method by setting an object as the second argument instead of a function.
```ts
import { registerEndpoint } from 'nuxt-vitest/utils'

registerEndpoint("/test/", {
method: "POST",
handler: () => ({ test: "test-field" })
})
```
> **Note**: If your requests in a component go to external API, you can use `baseURL` and then make it empty using Nuxt Enviroment Config (`$test`) so all your requests will go to Nitro server.
### Conflict with @nuxt/test-utils
Expand Down

0 comments on commit ac2a1f8

Please sign in to comment.