
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
apicase-adapter-fetch
Advanced tools
Fetch adapter for apicase-core
Fetch adapter is out-of-the-box adapter and it's installed in apicase-core by default
apicase.call({
adapter: 'fetch',
parser: 'json',
url: '/api/posts',
method: 'GET',
headers: { token: 'my_secret_token' },
query: { userId: 1 }
})
.then(console.log)
.catch(console.error)
It will call:
fetch('/api/posts?userId=1', {
method: 'GET',
headers: { token: 'my_secret_token' }
})
.then(res => res.json())
.then(console.log)
.catch(console.error)
Fetch adapter also has path-to-regexp to pass urls params smarter. Params are stored in params property
apicase.call({
adapter: 'fetch',
url: '/api/posts/:id',
params: { id: 1 }
})
// => GET /api/posts/1
If you want to create dynamic headers object so you can pass headers property as function that returns headers object
apicase.call({
adapter: 'fetch',
url: '/api/posts',
method: 'POST',
headers: () => ({
token: localStorage.getItem('token')
})
})
It will be called every time you make a request so if token will be removed, header won't be sent too.
MIT
FAQs
This package is no longer supported and has been deprecated. To avoid malicious use, npm is hanging on to the package name.
The npm package apicase-adapter-fetch receives a total of 2 weekly downloads. As such, apicase-adapter-fetch popularity was classified as not popular.
We found that apicase-adapter-fetch demonstrated a not healthy version release cadence and project activity because the last version was released 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
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.