Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
@nuxt-alt/http
Advanced tools
This serves as an extension to ohmyfetch for nuxt. This works similar to nuxt/http
and nuxtjs-alt/axios
except it utilizes ohmyfetch. All property options will be under http
. This module is required in order for @nuxt-alt/auth
to function.
@nuxt-alt/http
dependency to your projectyarn add @nuxt-alt/http
@nuxt-alt/http
to the modules
section of nuxt.config.ts
export default defineNuxtConfig({
modules: [
'@nuxt-alt/http'
],
http: {
/* module options */
}
});
Remember this is a mix of ofetch
and nuxt/http
so to use methods you would use as an example:
// Available methods: 'get', 'head', 'delete', 'post', 'put', 'patch', 'options'
// $http.$get('/api', options) and $http.$get({ url: '/api' }) is the same as $fetch('/api', { method: 'get' })
await $http.$get('/api', options)
await $http.$get({ url: '/api', ...options })
// Access Raw Response
// $http.get('/api', options) and $http.get({ url: '/api' }) is the same as $fetch.raw('/api', { method: 'get' })
await $http.get('/api', options)
await $http.get({ url: '/api', ...options })
// $http.request('/api', options) and $http.request({ url: '/api' }) is the same as $fetch('/api', options)
await $http.request({ url: '/api', ...options })
await $http.request('/api', options)
// Access Raw Response
// $http.raw('/api', options) and $http.raw({ url: '/api' }) is the same as $fetch.raw('/api', options)
await $http.raw({ url: '/api', ...options })
await $http.raw('/api', options)
// Access Fetch Native Response
// $http.natvie('/api', options) and $http.native({ url: '/api' }) is the same as $fetch.native('/api', options) or fetch('/api', options)
await $http.native({ url: '/api', ...options })
await $http.native('/api', options)
A useHttp
composable is avaialble, it works like useFetch
except uses this module under the hood.
The interceptors should work exactly like how axios has it so to access them you would use:
$http.interceptors.request.use(config)
$http.interceptors.response.use(response)
A interceptorPlugin
property has been added. This relies on the proxy module being present and will proxy urls based on the target for the client.
@nuxtjs-axios based functions have also been added:
$http.onRequest(config)
$http.onResponse(response)
$http.onRequestError(err)
$http.onResponseError(err)
$http.onError(err)
Config options are taken from the http module. In addition an additional properyul has been added.
FAQs
An extended module to ohmyfetch
The npm package @nuxt-alt/http receives a total of 2,504 weekly downloads. As such, @nuxt-alt/http popularity was classified as popular.
We found that @nuxt-alt/http demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.