6
votes

GET http://localhost:3000/data/posts.json 431 (Request Header Fields Too Large) I am getting an error mentioned above. I am using local server "npm server" (No Xampp or WAMP)

JSON file is downloaded from here "https://gorest.co.in/public-api/users?_format=json&access-token=UrX-V34IN7O-1TV0HEaVUCRUz65B9-ibL6M1" I have downloaded this file on local server.

My Code is:

const API = './data/posts.json';

componentDidMount(){

        fetch(API)
        .then(response => response.text())
        .then( (data) => { console.log("data - ", data) } )
    }
3

3 Answers

7
votes

You need to delete all the saved cookies for your localhost:3000.

1-chrome settings

2-on the left menu, click on Privacy and security tab

3-go to "privacy and security" section

4-click on site settings

5-click "view permissions and data stored across sites"

6-find localhost and on the right menu reset data

4
votes

Clearing site data from browser worked for me:

Go to console -> select application -> Clear Storage -> Clear Site Data

0
votes

If you are using Node v12.x.x, then try to upgrade it to v14.x.x.