Hi, can anyone please tell me how to send an authorization header with a get request? I am making the request as
mywebsite.com is available for purchase - Sedo.com and my get_Menus function is within my http-functions.js files as:
import {ok, notFound, serverError} from ‘wix-http-functions’;
import wixData from ‘wix-data’;
export function get_Menus(request) {
let options = {
“headers”: {
“Content-Type”: “application/json”
}
};
// query a collection to find matching items
return wixData.query(“Menus”)
.find()
.then( (results) => {
// matching items were found
if(results.items.length > 0) {
options.body = {
"items": results.items
};
return ok(options);
}
// no matching items found
options.body = {
"error": `'${request.path[0]} ${request.path[1]}' was not found`
};
return notFound(options);
} )
// something went wrong
.catch( (error) => {
options.body = {
"error": error
};
return serverError(options);
} );
}
Thanks in advance!