Skip to content

Commit 741e8c2

Browse files
authored
Merge pull request #59 from ferflores507/dev
Dev
2 parents 46a6afc + 05d4e47 commit 741e8c2

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@ferflores507/object-builder",
3-
"version": "9.8.0",
3+
"version": "9.8.1",
44
"main": "index.js",
55
"scripts": {
66
"test": "vitest"

src/helpers/varios.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
type Modify<T, R> = Omit<T, keyof R> & R;
2-
const applicationJson = "application/json"
32

43
export const fetchHelper = async (request: RequestInitWithUrl, init?: RequestInit) => {
54
// Verify if its ok to add signal in 2nd param object or spread to request
@@ -44,8 +43,7 @@ const findFirstAndFormat = (items: [any, (val: any) => any][]) => {
4443
export const buildRequest = (options: RequestPlainOptions) : RequestInitWithUrl => {
4544
const {
4645
url,
47-
method,
48-
contentType = applicationJson,
46+
method = "GET",
4947
headers = {},
5048
query = {},
5149
body,
@@ -56,7 +54,7 @@ export const buildRequest = (options: RequestPlainOptions) : RequestInitWithUrl
5654
url: urlWithCleanQueryString(url, query),
5755
method,
5856
headers: {
59-
...(formData ? {} : { "Content-Type": contentType }),
57+
...((formData || method === "GET") ? {} : { "content-type": "application/json" }),
6058
...headers
6159
},
6260
body: findFirstAndFormat([

0 commit comments

Comments
 (0)