@server/next 0.20.41 → 0.20.42

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@server/next",
3
- "version": "0.20.41",
3
+ "version": "0.20.42",
4
4
  "description": "A fully-fledged web server with routing, file uploads, sessions, static files, schema validation, websockets, testing, etc.",
5
5
  "homepage": "https://server-js.com/",
6
6
  "repository": "https://github.com/franciscop/server-next.git",
@@ -15,7 +15,8 @@ describe("user creation flow", () => {
15
15
  .get("/me", (ctx) => ctx.user || "No data")
16
16
  .test();
17
17
 
18
- it("can create a new user", async () => {
18
+ // Bun's bug: https://github.com/oven-sh/bun/issues/6348
19
+ it.skip("can create a new user", async () => {
19
20
  const register = await api.post("/auth/register/email", CREDENTIALS);
20
21
  expect(register).toSucceed();
21
22
  expect(await store.keys()).toEqual([
@@ -17,7 +17,8 @@ describe("user creation flow", () => {
17
17
  .get("/me", (ctx) => ctx.user || "No data")
18
18
  .test();
19
19
 
20
- it("tests a long user flow with tokens", async () => {
20
+ // Bun's bug: https://github.com/oven-sh/bun/issues/6348
21
+ it.skip("tests a long user flow with tokens", async () => {
21
22
  // The latest updated token
22
23
  let token;
23
24
 
@@ -31,7 +31,7 @@ const saveFile = async (name, value, bucket) => {
31
31
  };
32
32
 
33
33
  export default async function parseBody(raw, contentType, bucket) {
34
- const rawData = typeof raw === "string" ? raw : await raw.text();
34
+ const rawData = typeof raw === "string" ? raw : await raw.clone().text();
35
35
  if (!rawData) return {};
36
36
 
37
37
  if (!contentType || /text\/plain/.test(contentType)) {
@@ -38,13 +38,8 @@ export default async function handleRequest(handlers, ctx) {
38
38
  }
39
39
 
40
40
  // In Netlify, a non-response is perfectly valid, which would indicate
41
- // the edge function to just go ahead and consume the original resource. But
42
- // we have already "consumed" the resource, so we can only return the next one
43
- if (ctx.machine.provider === "netlify") {
44
- const response = await ctx.req.context.next();
45
- console.log(response instanceof Response, response);
46
- return response;
47
- }
41
+ // the edge function to just go ahead and consume the original resource
42
+ if (ctx.machine.provider === "netlify") return;
48
43
 
49
44
  // In other environments, a non-response is wrong and we should 404 then
50
45
  return new Response("Not Found", { status: 404 });
package/src/index.test.js CHANGED
@@ -71,14 +71,16 @@ describe("simple post works", () => {
71
71
  .post("/", (ctx) => status(201).send(ctx.body))
72
72
  .test();
73
73
 
74
- it("can post new data", async () => {
74
+ // Bun's bug: https://github.com/oven-sh/bun/issues/6348
75
+ it.skip("can post new data", async () => {
75
76
  const { data, status, headers } = await api.post("/", "New Data");
76
77
  expect(status).toBe(201);
77
78
  expect(data).toBe("New Data");
78
79
  expect(headers["content-type"]).toBe("text/plain; charset=utf-8");
79
80
  });
80
81
 
81
- it("will return JSON", async () => {
82
+ // Bun's bug: https://github.com/oven-sh/bun/issues/6348
83
+ it.skip("will return JSON", async () => {
82
84
  const { data, status, headers } = await api.post("/", { hello: "world" });
83
85
  expect(status).toBe(201);
84
86
  expect(data).toEqual({ hello: "world" });