
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
A lightweight Promise based HTTP client, using Fetch API.
npm i --save fitch
With ES2015 or TypeScript:
import fitch from 'fitch'
CommonJS:
const fitch = require('fitch')
UMD:
<script src="https://unpkg.com/fitch/dist/index.umd.min.js"></script>
fitch.get(apiUrl)
.then(response => console.log(response))
/* Response:
{
data: { foo: 'bar' },
status: 200,
statusText: 'Ok',
headers: { Content-Type: application/json },
}
*/
fitch.get(apiUrl)
.then(response => console.log(response))
const req = {body: {name: 'Happy cat'}}
fitch.post(apiUrl, req)
.then(response => console.log(response))
const req = {body: {name: 'Happy cat'}}
fitch.put(apiUrl, req)
.then(response => console.log(response))
const req = {body: {name: 'Happy cat'}}
fitch.patch(apiUrl, req)
.then(response => console.log(response))
fitch.del(apiUrl)
.then(response => console.log(response))
const config = {
cache = 'no-store',
headers = { 'Content-Type': 'application/json' },
mode = 'no-cors',
params: { // transform to '?test1=test-1&test2=test-2'
test1: 'test-1',
test2: 'test-2',
},
raw = true, // return the raw output of fetch()
redirect: 'follow',
}
fitch.get(apiUrl, config)
.then(response => console.log(response))
See more about fetch configuration at: Fetch API.
Helper function for dealing with concurrent requests.
const reqDogs = fitch.get('/dogs')
const reqCats = fitch.get('/cats')
function doSomething([ responseDogs, responseCats ]) {
console.log('Dogs\t>>>', responseDogs)
console.log('Cats\t>>>', responseCats)
}
fitch.all([ reqDogs, reqCats ])
.then(doSomething)
| |
|
|
|
| --------- | --------- | --------- | --------- | --------- | --------- |
| IE10, IE11, Edge| Every versions| Every versions| 6.1+|
Note: modern browsers such as Chrome, Firefox, and Microsoft Edge contain native implementations of window.fetch, so the polyfill doesn't have any affect on those browsers. See more at window.fetch polyfill.
Read the Code of conduct.
First yout need to fork this repository. Then:
npm i # install local dependencies
npm start # run local server
npm run watch:test # watch files inside src/ and tests/
npm run examples # run examples
Note: Your code must be tested and pass in linter check.
You can verify your code with ESLint, using npm run lint
.
Copyright © Bárbara Schoen
FAQs
A lightweight Promise based HTTP client, using Fetch API.
We found that fitch 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
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.