Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

{"statusCode":400,"error":"Bad Request","message":"Unexpected token o in JSON at position 1"}


   	var data = {
            "username": login,
            "password": password,
            "passwordAgain": password
    };

    if (password.length <= 5 || login.length <= 3)
        throw new Error("Password / Username to short !");


    console.log(`${SERVER_URL}/register`);
    const response = await fetch(`${SERVER_URL}/register`,{
        method:'POST',
        headers:{ 'content-type': 'application/json' },
        body: data // < ===== Error from here ! Change it to JSON.stringify(data)
    });

    const body = await response.text();

    const $ = cheerio.load(body);
Comment

PREVIOUS NEXT
Code Example
Javascript :: Change HTML Content 
Javascript :: lexical environment in javascript 
Javascript :: angular firebase 
Javascript :: transition css with js 
Javascript :: hide urls in .env in react app 
Javascript :: react-multi-carousel infinite loop causing issue 
Javascript :: javascript for pop up 
Javascript :: graphql buildschema 
Javascript :: mongoose get elements that contain substring 
Javascript :: The toUpperCase JavaScript string method 
Javascript :: react event listener 
Javascript :: adding cors parameters to extjs ajax 
Javascript :: persistent bugger javascript code 
Javascript :: add material angular 
Javascript :: react final form 
Javascript :: convertir lista a Json en Java 
Javascript :: pandas json_normalize column with json array 
Javascript :: batch mkdir 
Javascript :: javascript stringify blob 
Javascript :: javascript sort two-dimensional array by column 
Javascript :: window width onload jquery 
Javascript :: toggle function in javascript 
Javascript :: javascript bounce animation 
Javascript :: set range background color google script multiple colors 
Javascript :: code javascript 
Javascript :: input hook react 
Javascript :: detect scroll height 
Javascript :: sum array elements in javascript 
Javascript :: function create array javascript 
Javascript :: javascript example 
ADD CONTENT
Topic
Content
Source link
Name
8+6 =