Skip to content
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

Dynamic file type support #21

Open
3 tasks done
5ouma opened this issue Jun 21, 2024 · 1 comment
Open
3 tasks done

Dynamic file type support #21

5ouma opened this issue Jun 21, 2024 · 1 comment
Assignees
Labels
🎉 New Feature Introduce a new feature

Comments

@5ouma
Copy link
Owner

5ouma commented Jun 21, 2024

✏️ Describe the feature

Currently, it responds to the request with contents as text/plain so they must be code files. However, some people might specify non-text files such as images or videos, so it should detect the file type and change the response MIME type.

✔︎ Confirm these checks

🗒️ Additional Information

reproxy/src/router.ts

Lines 4 to 14 in 1bb2d1f

export const router = new Router();
router
.get("/", async <R extends string>(ctx: RouterContext<R>) => {
ctx.response.type = "text/plain";
if (!redirect(ctx, ctx.request.userAgent)) await getContent(ctx);
})
.get("/:ref", async <R extends string>(ctx: RouterContext<R>) => {
const ref: string | undefined = ctx.params.ref;
ctx.response.type = "text/plain";
if (!redirect(ctx, ctx.request.userAgent, ref)) await getContent(ctx, ref);
});

@5ouma 5ouma added the 🎉 New Feature Introduce a new feature label Jun 21, 2024
@5ouma 5ouma self-assigned this Jun 21, 2024
@5ouma
Copy link
Owner Author

5ouma commented Jun 27, 2024

@std/media-types might be the good choice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🎉 New Feature Introduce a new feature
Projects
None yet
Development

No branches or pull requests

1 participant