8000 DX-1902: Check for includes instead of exact match in isText by CahidArda · Pull Request #105 · upstash/workflow-js · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

DX-1902: Check for includes instead of exact match in isText #105

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 20, 2025
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
6 changes: 3 additions & 3 deletions src/context/steps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ export class LazyCallStep<TResult = unknown, TBody = unknown> extends BaseLazySt
}
}

private static applicationHeaders = new Set([
private static applicationContentTypes = [
"application/json",
"application/xml",
"application/javascript",
Expand All @@ -402,13 +402,13 @@ export class LazyCallStep<TResult = unknown, TBody = unknown> extends BaseLazySt
"application/ld+json",
"application/rss+xml",
"application/atom+xml",
]);
];

private static isText = (contentTypeHeader: string | null) => {
if (!contentTypeHeader) {
return false;
}
if (LazyCallStep.applicationHeaders.has(contentTypeHeader)) {
if (LazyCallStep.applicationContentTypes.some((type) => contentTypeHeader.includes(type))) {
return true;
}
if (contentTypeHeader.startsWith("text/")) {
Expand Down
4 changes: 3 additions & 1 deletion src/serve/serve.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1020,7 +1020,9 @@ describe("serve", () => {
qstashClient.batch = jest
.fn()
.mockReturnValue([{ deduplicatedId: false, messageId: "some-message-id" }]);
qstashClient.publish = jest.fn({ deduplicatedId: false, messageId: "some-message-id" });
qstashClient.publish = jest
.fn()
.mockReturnValue({ deduplicatedId: false, messageId: "some-message-id" });
const client = new WorkflowClient({ token: process.env.QSTASH_TOKEN! });

test("allow http://", async () => {
Expand Down
Loading
0