Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions src/api/yepcodeApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,7 @@ export class YepCodeApi {
async getProcesses(
params: {
keywords?: string;
tags?: string[];
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Array Parameter Serialization Issue

The getProcesses method's tags parameter (a string[]) is serialized as a comma-separated string in the URL query. This happens because the request method calls toString() on arrays, which likely doesn't align with the API's expected format for array parameters (e.g., ?tags=tag1&tags=tag2), potentially causing malformed requests.

Fix in Cursor Fix in Web

page?: number;
limit?: number;
} = {}
Expand Down
32 changes: 32 additions & 0 deletions tests/api/yepcodeApi.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { YepCodeApi } from "../../src/api/yepcodeApi";
import { ProcessesPaginatedResult } from "../../src/api/types";

const api = new YepCodeApi();

describe("YepCodeApi", () => {
describe("processes", () => {
it("should return a paginated list of processes", async () => {
const result: ProcessesPaginatedResult = await api.getProcesses();

expect(result).toHaveProperty("hasNextPage");
expect(result).toHaveProperty("page");
expect(result).toHaveProperty("limit");
expect(result).toHaveProperty("total");
expect(result).toHaveProperty("data");
expect(Array.isArray(result.data)).toBe(true);
});

it("should return a paginated list of processes with a tag", async () => {
const result: ProcessesPaginatedResult = await api.getProcesses({
tags: ["yc-run", "dummy"],
});

expect(result).toHaveProperty("hasNextPage");
expect(result).toHaveProperty("page");
expect(result).toHaveProperty("limit");
expect(result).toHaveProperty("total");
expect(result).toHaveProperty("data");
expect(Array.isArray(result.data)).toBe(true);
});
});
});