Search.../

forbidden( )

Returns a response with status code 403 (Forbidden) and the information from the options parameter.

Description

The forbidden() function creates a response with the status code 403 (Forbidden).

Optionally, the forbidden() function can take a WixHttpFunctionResponseOptions object which is used to specify the response's body and headers. If the object contains a status it will be ignored.

Use the forbidden() function to create a response to return from an HTTP function. A 403 (Forbidden) response is used to indicate the request was valid but the server is refusing to process it, usually because the client does not have the necessary permissions for the requested resource.

Syntax

function forbidden(options: WixHttpFunctionResponseOptions): WixHttpFunctionResponse

forbidden Parameters

NAME
TYPE
DESCRIPTION
options

WixHttpFunctionResponseOptions

The response options.

Returns

Was this helpful?

Create a 403 (Forbidden) response

Code Example

Copy Code
1// In http-functions.js
2
3import {forbidden} from 'wix-http-functions';
4
5export function use_myFunction(request) {
6
7 return forbidden();
8}
Create a 403 (Forbidden) response

Code Example

Copy Code
1// In http-functions.js
2
3import {forbidden} from 'wix-http-functions';
4
5export function use_myFunction(request) {
6
7 let options = {
8 body: {
9 "error": "forbidden",
10 },
11 headers: {
12 "Content-Type": "application/json"
13 }
14 };
15
16 return forbidden(options);
17}