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

build: Fix up integration test API #30

Merged
merged 1 commit into from
Dec 15, 2023
Merged
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
9 changes: 3 additions & 6 deletions integration-tests/test-api/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,18 @@ import { Hono } from "hono";

const app = new Hono();

app.get("/", (c) => c.text("Hello Hono!"));

app.all(
"/:status{[0-9]{3}}/upload/bundle_analysis/v1/:badPUT{true|false}",
"/test-url/:status/:badPUT{true|false}/upload/bundle_analysis/v1",
nicholas-codecov marked this conversation as resolved.
Show resolved Hide resolved
(c) => {
nicholas-codecov marked this conversation as resolved.
Show resolved Hide resolved
const status = parseInt(c.req.param("status"));
nicholas-codecov marked this conversation as resolved.
Show resolved Hide resolved
const badPUT = c.req.param("badPUT") === "true";
const url = new URL(c.req.url);
let putURL = `${url.protocol}//${url.host}/file-upload`;
nicholas-codecov marked this conversation as resolved.
Show resolved Hide resolved

if (status >= 400 && !badPUT) {
return c.text(`Error code: ${status}`, { status });
}

const url = new URL(c.req.url);
let putURL = `${url.protocol}//${url.host}/file-upload`;

if (badPUT) {
putURL = `${putURL}/${status}`;
}
Expand Down