hono-utils 0.3.2 → 0.3.3

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/dist/index.cjs CHANGED
@@ -13925,17 +13925,17 @@ var queue = ({
13925
13925
 
13926
13926
 
13927
13927
  var setResponseHandlers = (c) => {
13928
- const method = c.req.method;
13929
13928
  return {
13930
13929
  raw: (data) => {
13931
13930
  const { status, ...rest } = data;
13932
13931
  return c.json(rest, status || 200);
13933
13932
  },
13934
13933
  success: (message, data, status) => {
13935
- const statusCode = status || (method === "POST" ? 201 : 200);
13936
- if (data) {
13937
- return c.json({ message, data }, statusCode);
13938
- }
13934
+ const statusCode = status || 200;
13935
+ return c.json({ message, data }, statusCode);
13936
+ },
13937
+ successNoContent: (message, status) => {
13938
+ const statusCode = status || 200;
13939
13939
  return c.json({ message }, statusCode);
13940
13940
  },
13941
13941
  error: (message, status) => {
@@ -13953,7 +13953,9 @@ var setResponseHandlers = (c) => {
13953
13953
  };
13954
13954
  var response = _factory.createMiddleware.call(void 0, async (c, next) => {
13955
13955
  c.set("res", setResponseHandlers(c));
13956
- c.header("x-event-id", c.var.eventId);
13956
+ if (c.var.eventId) {
13957
+ c.header("x-event-id", c.var.eventId);
13958
+ }
13957
13959
  await next();
13958
13960
  });
13959
13961