Skip to content

Commit

Permalink
Major sanitize fix
Browse files Browse the repository at this point in the history
  • Loading branch information
rgxdev committed May 24, 2024
1 parent 06e9c30 commit cabf1f3
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions package/methods/get.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const get = async (path, options = {}) => {
url.searchParams.append(key, sanitizeInput(value, key));
});


const requestOptions = {
method: 'GET',
headers: { ...config.headers, ...options.headers },
Expand Down
2 changes: 1 addition & 1 deletion package/methods/patch.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const patch = async (path, data = null, options = {}) => {
});

const sanitizedData = config.sanitize
? Object.fromEntries(Object.entries(data || {}).map(([key, value]) => [key, sanitizeInput(value, key.includes('email'))]))
? Object.fromEntries(Object.entries(data || {}).map(([key, value]) => [key, sanitizeInput(value, key)]))
: data;

const postData = JSON.stringify(sanitizedData);
Expand Down
2 changes: 1 addition & 1 deletion package/methods/post.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const post = async (path, data = null, options = {}) => {
});

const sanitizedData = config.sanitize
? Object.fromEntries(Object.entries(data || {}).map(([key, value]) => [key, sanitizeInput(value, key.includes('email'))]))
? Object.fromEntries(Object.entries(data || {}).map(([key, value]) => [key, sanitizeInput(value, key)]))
: data;

const postData = JSON.stringify(sanitizedData);
Expand Down
2 changes: 1 addition & 1 deletion package/methods/put.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const put = async (path, data = null, options = {}) => {
});

const sanitizedData = config.sanitize
? Object.fromEntries(Object.entries(data || {}).map(([key, value]) => [key, sanitizeInput(value, key.includes('email'))]))
? Object.fromEntries(Object.entries(data || {}).map(([key, value]) => [key, sanitizeInput(value, key)]))
: data;

const postData = JSON.stringify(sanitizedData);
Expand Down
2 changes: 1 addition & 1 deletion package/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "fetch-ninja",
"version": "0.0.3",
"version": "0.0.4",
"description": "A libary to make fetch requests easier",
"main": "index.js",
"license": "MIT",
Expand Down

0 comments on commit cabf1f3

Please sign in to comment.