Skip to content

Commit

Permalink
fixed bug to pass back status (Helicone#494)
Browse files Browse the repository at this point in the history
  • Loading branch information
chitalian authored Jun 15, 2023
1 parent 7e023ff commit 0471e19
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions worker/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export interface Env {
SUPABASE_SERVICE_ROLE_KEY: string;
SUPABASE_URL: string;
TOKENIZER_COUNT_API: string;
TOKEN_COUNT_URL: string;
RATE_LIMIT_KV: KVNamespace;
CLICKHOUSE_HOST: string;
CLICKHOUSE_USER: string;
Expand Down
1 change: 1 addition & 0 deletions worker/src/lib/HeliconeProxyRequest/forwarder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,5 +134,6 @@ export async function proxyForwarder(
return responseBuilder.build({
body: response.body,
inheritFrom: response,
status: response.status,
});
}
5 changes: 2 additions & 3 deletions worker/src/lib/ResponseBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { RateLimitOptions, RateLimitResponse } from "../rateLimit";

export interface BuildParams {
body: BodyInit | null;
status?: number;
status: number;
inheritFrom?: Response;
}

Expand Down Expand Up @@ -36,8 +36,7 @@ export class ResponseBuilder {
}

build(params: BuildParams): Response {
const { body, inheritFrom: _inheritFrom, status: _status } = params;
const status = _status ?? 200;
const { body, inheritFrom: _inheritFrom, status } = params;
const inheritFrom = _inheritFrom ?? new Response();

const headers = new Headers(inheritFrom.headers);
Expand Down

0 comments on commit 0471e19

Please sign in to comment.