Search.../

response( )

Returns a response populated with the information from the options parameter. The response() function creates a custom response built with the information passed to the options parameter in a WixHttpFunctionResponseOptions object.

Use the response() function to create a response to return from an HTTP function.

Syntax

function response(options: WixHttpFunctionResponseOptions): WixHttpFunctionResponse

response Parameters

NAME
TYPE
DESCRIPTION
options

WixHttpFunctionResponseOptions

The response options.

Returns

Was this helpful?

Create a response

Code Example

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

Code Example

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