Hi,
I am just building a sample app and tried making use of post call. I was trying to use $request.post like this:
$request.post(post_url, options).then (
function(data) {
console.log("posted successfully. Response " + JSON.parse(data));
},
function(error) {
console.log(error);
});
I got this error on hitting the above post call:
{ status: 400,
headers:
{ date: 'Fri, 05 Feb 2021 16:44:34 GMT',
'content-type': 'text/html',
'transfer-encoding': 'chunked',
connection: 'close',
'set-cookie':
[ '__cfduid=de00b92dad0bac6b99f5f57fc02171b251612543474; expires=Sun, 07-Mar-21 16:44:34 GMT; path=/; domain=.remotive.io; HttpOnly; SameSite=Lax' ],
'cf-cache-status': 'DYNAMIC',
'cf-request-id': '0814add1b40000dd8f7b006000000001',
'expect-ct':
'max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"',
'report-to':
'{"max_age":604800,"endpoints":[{"url":"https:\\/\\/a.nel.cloudflare.com\\/report?s=1SC1y%2BK5jWOyqiFWoL5QaqC0GTYCnYuutmXjxivafMHC9HTOSgnrVnBLdR5WTccCyKR4FB2rgvURDPIrjMTF9ChDeWvjAUROjJOXUqMH3Zw8"}],"group":"cf-nel"}',
nel: '{"report_to":"cf-nel","max_age":604800}',
server: 'cloudflare',
'cf-ray': '61ce18c92ab5dd8f-SIN' },
response:
'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">\n<title>400 Bad Request</title>\n<h1>Bad Request</h1>\n<p>Session expired (invalid CSRF token)</p>\n',
attempts: 1,
errorSource: 'APP' }
I looked up other product implementation of the request method, and its exactly how I have done. Can someone please help me understand this issue better?