NoContent class represents a successful HTTP response with status code 204. It is used to standardize "No Content" responses, typically when an operation succeeds but there is no content to return in the response body.ts
import { NoContent } from "@arkyn/server";
message (required): A message describing the operation status. This is included for logging and debugging purposes but is not sent in the response body since 204 responses must not include a body per HTTP specification.toResponse() - Converts the instance into a Response object with no body and Content-Type: application/json header.typescript
import { NoContent } from "@arkyn/server";// Delete operation with no response bodyconst response = new NoContent("Resource deleted successfully");return response.toResponse();// Update operation that doesn't need to return datareturn new NoContent("Settings updated").toResponse();// Acknowledge operationreturn new NoContent("Notification marked as read").toResponse();
null). Only the status code (204) and status text are returned.NoContent does not accept a body parameter and does not have a toJson() method, as 204 responses must not include a response body per HTTP specification.