Search...
notFound( )
Returns a response with status code 404 (Not Found) and the information from the options parameter.
Description
The notFound()
function creates a response with the status code 404 (Not Found).
Optionally, the notFound()
function can take a WixHttpFunctionResponseOptions
object which is used to specify the response's body and headers.
Note: If the object contains a status it will be ignored.
Use the notFound()
function to create a response to return from an HTTP
function. A 404 (Not Found) response is usually used to indicate that the
requested resource was not found at the current time.
Syntax
function notFound([options: WixHttpFunctionResponseOptions]): WixHttpFunctionResponse
notFound Parameters
NAME
TYPE
DESCRIPTION
options
Optional
WixHttpFunctionResponseOptions
The response options.
Returns
Return Type:
Was this helpful?
Create a 404 (Not Found) response
Copy Code
1// In http-functions.js23import {notFound} from 'wix-http-functions';45export function use_myFunction(request) {67 return notFound();8}
Create a 404 (Not Found) response
Copy Code
1// In http-functions.js23import {notFound} from 'wix-http-functions';45export function use_myFunction(request) {67 let options = {8 body: {9 "error": "not found"10 },11 headers: {12 "Content-Type": "application/json"13 }14 };1516 return notFound(options);17}