Skip to content

Commit

Permalink
publish and fix latest npm
Browse files Browse the repository at this point in the history
  • Loading branch information
umutozel committed Feb 16, 2025
1 parent 76cc669 commit 1adeccd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
15 changes: 8 additions & 7 deletions lib/fetch-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,17 @@ export class FetchProvider implements IAjaxProvider<Response, FetchOptions> {
}

export function createRequest(o: FetchOptions) {
const oo = Object.assign({}, FetchProvider.defaultOptions, o);
const ao = Object.fromEntries(Object.entries(oo).filter(([key]) => key[0] != "$"));
const ao = Object.fromEntries(Object.entries(o).filter(([key]) => key[0] != "$"));

ao.method = ao.method || oo.$method;
if (ao.$method != "GET" && oo.$data != null && Object.keys(oo.$data).length > 0) {
ao.body = JSON.stringify(oo.$data);
ao.method = ao.method || o.$method || FetchProvider.defaultOptions.$method;
if (ao.$method != "GET" && o.$data != null && Object.keys(o.$data).length > 0) {
ao.body = JSON.stringify(o.$data);
}
if (oo.$headers != null) {
ao.headers = Object.assign(ao.headers || {}, oo.$headers);
let headers = Object.assign({}, FetchProvider.defaultOptions.$headers, ao.headers);
if (o.$headers != null) {
headers = Object.assign(headers, o.$headers);
}
ao.headers = headers;

return ao;
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jinqu-fetch",
"version": "2.0.3",
"version": "2.0.4",
"description": "Jinqu Fetch implementation",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down

0 comments on commit 1adeccd

Please sign in to comment.