Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

cookie parser object null prototype

// Try adding credentials: 'include' to your fetch call, like so:
// The reason it works when you manually access the address is because HTTP requests made
// by the browser send cookies in the header by default. Fetch doesn't.
// Like for this guy https://stackoverflow.com/questions/67970252/req-cookies-is-object-null-prototype-on-express-router

fetch(`${config.hosts.INTERNAL_API}/`, { 
    method: "GET",
    credentials: "include",
    headers: {
        Accept: 'application/json',
        'Content-Type': 'application/json',
      },
}).then(res => res.json()).then(data => this.setState(data))
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #cookie #parser #object #null #prototype
ADD COMMENT
Topic
Name
3+1 =