Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
7 changes: 7 additions & 0 deletions packages/sdk/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

# Changelog

## [1.5.3] - 2025-04-18

### Added

- Added `ProxyResponse` type for makeProxyRequest
- changed the location of connect DEBUG calls so they'll still show in the error case.

Check failure on line 10 in packages/sdk/CHANGELOG.md

View workflow job for this annotation

GitHub Actions / test

Line length

packages/sdk/CHANGELOG.md:10:81 MD013/line-length Line length [Expected: 80; Actual: 86] https://github.com/DavidAnson/markdownlint/blob/v0.35.0/doc/md013.md

Check failure on line 10 in packages/sdk/CHANGELOG.md

View workflow job for this annotation

GitHub Actions / test

Line length

packages/sdk/CHANGELOG.md:10:81 MD013/line-length Line length [Expected: 80; Actual: 86] https://github.com/DavidAnson/markdownlint/blob/v0.35.0/doc/md013.md

## [1.5.2] - 2025-04-15

### Added
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@pipedream/sdk",
"type": "module",
"version": "1.5.2",
"version": "1.5.3",
"description": "Pipedream SDK",
"main": "./dist/server.js",
"module": "./dist/server.js",
Expand Down
10 changes: 9 additions & 1 deletion packages/sdk/src/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,14 @@
options: ProxyTargetApiOpts;
};

/**
* The parsed response body from a proxied API request.
*
* If the response has a Content-Type of application/json, the body will be parsed
* and returned as an object. Otherwise the type will be a string.
*/
export type ProxyResponse = Record<string, any> | string;

Check failure on line 158 in packages/sdk/src/server/index.ts

View workflow job for this annotation

GitHub Actions / Lint Code Base

Unexpected any. Specify a different type

/**
* Creates a new instance of BackendClient with the provided options.
*
Expand Down Expand Up @@ -422,7 +430,7 @@
*
* @returns A promise resolving to the response from the downstream service
*/
public makeProxyRequest(proxyOptions: ProxyApiOpts, targetRequest: ProxyTargetApiRequest): Promise<string> {
public makeProxyRequest(proxyOptions: ProxyApiOpts, targetRequest: ProxyTargetApiRequest): Promise<ProxyResponse> {
const url64 = btoa(targetRequest.url).replace(/\+/g, "-")
.replace(/\//g, "_")
.replace(/=+$/, "");
Expand Down
6 changes: 5 additions & 1 deletion packages/sdk/src/shared/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1021,11 +1021,15 @@ export abstract class BaseClient {

const rawBody = await response.text();

DEBUG("status: ", response.status)
DEBUG("url: ", url.toString())
DEBUG("requestOptions: ", requestOptions)
DEBUG("rawBody: ", rawBody)

if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}, body: ${rawBody}`);
}

DEBUG(response.status, url.toString(), requestOptions, rawBody)
const contentType = response.headers.get("Content-Type");
if (contentType && contentType.includes("application/json")) {
try {
Expand Down
Loading