Search...
ok( )
Returns a response with status code 200 (OK) and the information from the options parameter.
Description
The ok()
function creates a response with the status code 200 (OK).
Optionally, the ok()
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 response()
function to create a response to return from an HTTP
function. A 200 (OK) response is usually used to indicate that a request was successful.
Syntax
function ok(options: WixHttpFunctionResponseOptions): WixHttpFunctionResponse
ok Parameters
NAME
TYPE
DESCRIPTION
options
WixHttpFunctionResponseOptions
The response options.
Returns
Return Type:
Was this helpful?
Create a 200 (OK) response
Code Example
1// In http-functions.js23import {ok} from 'wix-http-functions';45export function use_myFunction(request) {67 return ok();8}
Create a 200 (OK) response
Code Example
1// In http-functions.js23import {ok} from 'wix-http-functions';45export function use_myFunction(request) {67 let options = {8 body: {9 "key1": "value1",10 "key2": "value2"11 },12 headers: {13 "Content-Type": "application/json"14 }15 };1617 return ok(options);18}