You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

fitch

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fitch - npm Package Compare versions

Comparing version

to
0.4.0

src/params.js

2

package.json
{
"name": "fitch",
"version": "0.3.2",
"version": "0.4.0",
"description": "Test using fetch API",

@@ -5,0 +5,0 @@ "main": "src/index.js",

@@ -83,2 +83,6 @@ ![Fitch.js](https://github.com/raphaelpor/fitch.js/raw/master/assets/fitch-mini.png)

raw = true, // return the raw output of fetch()
params: { // transform to '?test1=test-1&test2=test-2'
test1: 'test-1',
test2: 'test-2',
},
}

@@ -89,2 +93,3 @@

```
See more about fetch configuration at: [Fetch API](https://developer.mozilla.org/pt-BR/docs/Web/API/Fetch_API).

@@ -91,0 +96,0 @@ ## Browser Support

@@ -11,8 +11,9 @@ module.exports = {

) {
let data;
if (body) {
body = JSON.stringify(body);
data = JSON.stringify(body);
}
return {
method,
body,
body: data,
cache,

@@ -19,0 +20,0 @@ headers,

@@ -5,2 +5,3 @@ require('es6-promise').polyfill();

const config = require('./config');
const params = require('./params');

@@ -29,4 +30,8 @@ module.exports = {

request(method, url, req = {}) {
const params = config.create(method, req);
const call = fetch(url, params);
let paramsEncoded = '';
if (req.params) {
paramsEncoded = params.transform(req.params);
}
const configObj = config.create(method, req);
const call = fetch(url + paramsEncoded, configObj);
return req.raw ? call : call.then(this.check);

@@ -33,0 +38,0 @@ },

Sorry, the diff of this file is not supported yet