new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

Nuxt · API · all subjects

utils/ssr

4 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

setResponseStatus utility function

setResponseStatus is a utility that sets the HTTP status code (and optionally the statusText) of the response. It can only be called in the Nuxt context on the server side. The function takes three parameters: event (from useRequestEvent), statusCode (required), and statusText (optional). In the browser, setResponseStatus has no effect.

setResponseStatus signature and parameters

setResponseStatus(event, statusCode, statusText?) - event is the request event object from useRequestEvent(), statusCode is a number representing the HTTP status code, statusText is an optional string for the status message.

setResponseStatus server-only context requirement

setResponseStatus can only be called in the Nuxt context on the server side. It has no effect when called in the browser. The event from useRequestEvent() will be undefined in the browser.

setResponseStatus usage example for 404 page

const event = useRequestEvent() if (event) { setResponseStatus(event, 404) setResponseStatus(event, 404, 'Page Not Found') }

Give your agent this brain