@segment/actions-core
Advanced tools
Comparing version 2.0.2 to 2.0.3-next.0
@@ -29,2 +29,3 @@ "use strict"; | ||
const fetch_1 = __importStar(require("./fetch")); | ||
const omit_1 = require("./omit"); | ||
const real_type_of_1 = require("./real-type-of"); | ||
@@ -157,4 +158,12 @@ // We need the loose definition of "object" to iterate over things like `[object Headers]` | ||
this.options.signal = this.abortController.signal; | ||
this.cleanedOptions = omit_1.omit(this.options, [ | ||
'json', | ||
'password', | ||
'searchParams', | ||
'throwHttpErrors', | ||
'timeout', | ||
'username' | ||
]); | ||
// Construct a request object to send to the Fetch API | ||
this.request = new fetch_1.Request(url, this.options); | ||
this.request = new fetch_1.Request(url, this.cleanedOptions); | ||
// Parse search params and merge them with the request URL | ||
@@ -167,9 +176,9 @@ if (this.options.searchParams) { | ||
// Update the request object with the new url including the search params | ||
this.request = new fetch_1.Request(new fetch_1.Request(url.toString(), this.request), this.options); | ||
this.request = new fetch_1.Request(new fetch_1.Request(url.toString(), this.request), this.cleanedOptions); | ||
} | ||
// Automatically handle json header + stringification as a convenience when using `json` option | ||
if (this.options.json !== undefined) { | ||
this.options.body = JSON.stringify(this.options.json); | ||
this.cleanedOptions.body = JSON.stringify(this.options.json); | ||
this.request.headers.set('content-type', 'application/json'); | ||
this.request = new fetch_1.Request(this.request, { body: this.options.body }); | ||
this.request = new fetch_1.Request(this.request, { body: this.cleanedOptions.body }); | ||
} | ||
@@ -176,0 +185,0 @@ } |
import AbortController from 'abort-controller'; | ||
import { CustomError } from 'ts-custom-error'; | ||
import fetch, { Headers, Request, Response } from './fetch'; | ||
import { omit } from './omit'; | ||
import { isObject } from './real-type-of'; | ||
@@ -129,4 +130,12 @@ // We need the loose definition of "object" to iterate over things like `[object Headers]` | ||
this.options.signal = this.abortController.signal; | ||
this.cleanedOptions = omit(this.options, [ | ||
'json', | ||
'password', | ||
'searchParams', | ||
'throwHttpErrors', | ||
'timeout', | ||
'username' | ||
]); | ||
// Construct a request object to send to the Fetch API | ||
this.request = new Request(url, this.options); | ||
this.request = new Request(url, this.cleanedOptions); | ||
// Parse search params and merge them with the request URL | ||
@@ -139,9 +148,9 @@ if (this.options.searchParams) { | ||
// Update the request object with the new url including the search params | ||
this.request = new Request(new Request(url.toString(), this.request), this.options); | ||
this.request = new Request(new Request(url.toString(), this.request), this.cleanedOptions); | ||
} | ||
// Automatically handle json header + stringification as a convenience when using `json` option | ||
if (this.options.json !== undefined) { | ||
this.options.body = JSON.stringify(this.options.json); | ||
this.cleanedOptions.body = JSON.stringify(this.options.json); | ||
this.request.headers.set('content-type', 'application/json'); | ||
this.request = new Request(this.request, { body: this.options.body }); | ||
this.request = new Request(this.request, { body: this.cleanedOptions.body }); | ||
} | ||
@@ -148,0 +157,0 @@ } |
{ | ||
"name": "@segment/actions-core", | ||
"description": "Core runtime for Destinations Actions.", | ||
"version": "2.0.2", | ||
"version": "2.0.3-next.0", | ||
"repository": { | ||
@@ -70,3 +70,3 @@ "type": "git", | ||
}, | ||
"gitHead": "14341f8e1c2d3752747002d173b6501fab41bef3" | ||
"gitHead": "f863de6990a42d2da8f573d737bd6c1c97d508b0" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
264954
4297
2