From ca97ae89b7fc227100584f2b58adad31f55b11b9 Mon Sep 17 00:00:00 2001 From: "Nicholas J. Fiorello Jr" Date: Sun, 7 Jun 2020 14:17:44 -0400 Subject: [PATCH] add configuration useRelativeURLs --- README.md | 1 + src/OdataConfig.ts | 4 ++++ src/__snapshots__/o.spec.ts.snap | 1 + src/o.ts | 3 ++- 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index ad5833b..b80c5be 100644 --- a/README.md +++ b/README.md @@ -121,6 +121,7 @@ Basic configuration is based on [RequestInit](https://developer.mozilla.org/en-U "Content-Type": "multipart/mixed", }), useChangset: false, + useRelativeURLs: false, }, credentials: "omit", fragment: "value", diff --git a/src/OdataConfig.ts b/src/OdataConfig.ts index 2246759..a85696e 100644 --- a/src/OdataConfig.ts +++ b/src/OdataConfig.ts @@ -6,6 +6,10 @@ export interface OdataBatchConfig { boundaryPrefix?: string; useChangset: boolean; changsetBoundaryPrefix?: string; + /** + * When truthy, relative URL's will be used in batch elements + */ + useRelativeURLs: boolean; } export type OdataConfig = RequestInit & { diff --git a/src/__snapshots__/o.spec.ts.snap b/src/__snapshots__/o.spec.ts.snap index 3ece6be..17f94d4 100644 --- a/src/__snapshots__/o.spec.ts.snap +++ b/src/__snapshots__/o.spec.ts.snap @@ -12,6 +12,7 @@ Object { }, }, "useChangset": false, + "useRelativeURLs": false, }, "credentials": "omit", "fragment": "value", diff --git a/src/o.ts b/src/o.ts index 0040049..bd9d0fa 100644 --- a/src/o.ts +++ b/src/o.ts @@ -40,7 +40,8 @@ export function o(rootUrl: string | URL, config: OdataConfig | any = {}) { headers: new Headers({ "Content-Type": "multipart/mixed" }), - useChangset: false + useChangset: false, + useRelativeURLs: false }, credentials: "omit", fragment: "value",