Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions components/hubspot/hubspot.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -445,15 +445,39 @@ export default {
"Content-Type": "application/json",
};
},
// Recursively trim string values in accordance with Hubspot's validation rules
// https://developers.hubspot.com/changelog/breaking-change-enhanced-validations-for-non-string-properties-in-hubspots-crmobject-apis
trimStringValues(obj) {
if (typeof obj === "string") {
return obj.trim();
} else if (Array.isArray(obj)) {
return obj.map(this.trimStringValues);
} else if (obj !== null && typeof obj === "object") {
return Object.fromEntries(
Object.entries(obj).map(([
key,
value,
]) => [
key,
this.trimStringValues(value),
]),
);
}
return obj;
},
makeRequest({
$ = this,
api,
endpoint,
data,
params,
...otherOpts
}) {
return axios($, {
url: `${BASE_URL}${api}${endpoint}`,
headers: this._getHeaders(),
data: data && this.trimStringValues(data),
params: params && this.trimStringValues(params),
...otherOpts,
});
},
Expand Down
2 changes: 1 addition & 1 deletion components/hubspot/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/hubspot",
"version": "0.10.1",
"version": "0.10.2",
"description": "Pipedream Hubspot Components",
"main": "hubspot.app.mjs",
"keywords": [
Expand Down
2 changes: 1 addition & 1 deletion pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading